! 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% ;
: 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