combinators.cleave: ncleave

db4
Eduardo Cavazos 2008-07-05 06:45:47 -05:00
parent 12d22e593c
commit 28c86d07f5
1 changed files with 9 additions and 1 deletions

View File

@ -1,8 +1,16 @@
USING: kernel arrays sequences macros combinators ;
USING: kernel combinators quotations arrays sequences locals macros
shuffle combinators.lib ;
IN: combinators.cleave
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
:: [ncleave] ( SEQ N -- quot )
SEQ [ [ N nkeep ] curry ] map concat [ N ndrop ] append >quotation ;
MACRO: ncleave ( seq n -- quot ) [ncleave] ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Cleave into array
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!