]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/nmake/nmake.factor
factor: trim using lists
[factor.git] / basis / nmake / nmake.factor
index 80c3ce3411cdac137b4a2b67e95e429d640b1382..00c0a2041def07b7c00a5cfa01cb1f7dfe82bebf 100644 (file)
@@ -1,16 +1,16 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: namespaces sequences math.parser kernel macros
-generalizations locals ;
+USING: kernel math.parser namespaces sequences
+sequences.generalizations ;
 IN: nmake
 
-SYMBOL: building-seq 
+SYMBOL: building-seq
 : get-building-seq ( n -- seq )
     building-seq get nth ;
 
 : n, ( obj n -- ) get-building-seq push ;
 : n% ( seq n -- ) get-building-seq push-all ;
-: n# ( num n -- ) >r number>string r> n% ;
+: n# ( num n -- ) [ number>string ] dip n% ;
 
 : 0, ( obj -- ) 0 n, ;
 : 0% ( seq -- ) 0 n% ;
@@ -28,17 +28,13 @@ SYMBOL: building-seq
 : 4% ( seq -- ) 4 n% ;
 : 4# ( num -- ) 4 n# ;
 
-MACRO: finish-nmake ( exemplars -- )
+MACRO: finish-nmake ( exemplars -- quot )
     length [ firstn ] curry ;
 
 :: nmake ( quot exemplars -- )
-    [
-        exemplars
-        [ 0 swap new-resizable ] map
-        building-seq set
-
+    exemplars [ 0 swap new-resizable ] map
+    building-seq [
         quot call
-
         building-seq get
         exemplars [ [ like ] 2map ] [ finish-nmake ] bi
-    ] with-scope ; inline
+    ] with-variable ; inline