sequences: change implementation of interleave

db4
Slava Pestov 2009-06-14 18:22:31 -05:00
parent dd61b59937
commit 75276855ae
1 changed files with 5 additions and 3 deletions

View File

@ -508,9 +508,11 @@ PRIVATE>
(each-index) each-integer ; inline
: interleave ( seq between quot -- )
swap [ drop ] [ [ 2dip call ] 2curry ] 2bi
[ [ 0 = ] 2dip if ] 2curry
each-index ; inline
pick empty? [ 3drop ] [
[ [ drop first-unsafe ] dip call ]
[ [ rest-slice ] 2dip [ [ call ] bi@ ] 2curry each ]
3bi
] if ; inline
: map-index ( seq quot -- newseq )
[ dup length iota ] dip 2map ; inline