generalizations no longer needs locals
parent
34b0fad704
commit
cf79dc4646
|
@ -1,8 +1,8 @@
|
|||
! Copyright (C) 2007, 2008 Chris Double, Doug Coleman, Eduardo
|
||||
! Cavazos, Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel sequences sequences.private namespaces math math.ranges
|
||||
combinators macros quotations fry locals arrays ;
|
||||
USING: kernel sequences sequences.private namespaces math
|
||||
math.ranges combinators macros quotations fry arrays ;
|
||||
IN: generalizations
|
||||
|
||||
MACRO: narray ( n -- quot )
|
||||
|
@ -38,7 +38,7 @@ MACRO: ntuck ( n -- )
|
|||
2 + [ dupd -nrot ] curry ;
|
||||
|
||||
MACRO: nrev ( n -- quot )
|
||||
1 [a,b] [ '[ , -nrot ] ] map concat ;
|
||||
1 [a,b] [ ] [ '[ @ , -nrot ] ] reduce ;
|
||||
|
||||
MACRO: ndip ( quot n -- )
|
||||
dup saver -rot restorer 3append ;
|
||||
|
@ -50,11 +50,11 @@ MACRO: nkeep ( n -- )
|
|||
[ ] [ 1+ ] [ ] tri
|
||||
'[ [ , ndup ] dip , -nrot , nslip ] ;
|
||||
|
||||
MACRO: ncurry ( n -- ) [ curry ] n*quot ;
|
||||
MACRO: ncurry ( n -- )
|
||||
[ curry ] n*quot ;
|
||||
|
||||
MACRO:: nwith ( quot n -- )
|
||||
[let | n' [ n 1+ ] |
|
||||
[ n' -nrot [ n' nrot quot call ] n ncurry ] ] ;
|
||||
MACRO: nwith ( n -- )
|
||||
[ with ] n*quot ;
|
||||
|
||||
MACRO: napply ( n -- )
|
||||
2 [a,b]
|
||||
|
|
Loading…
Reference in New Issue