sequences.extras: adding "all-rotations".

db4
John Benediktsson 2012-09-09 10:37:24 -07:00
parent 7e9f3d665b
commit 4f3622849d
1 changed files with 3 additions and 0 deletions
extra/sequences/extras

View File

@ -126,6 +126,9 @@ IN: sequences.extras
2over = [ -rot nip over ] when
] until 3drop ;
: all-rotations ( seq -- seq' )
dup length iota [ rotate ] with map ;
: appender-for ( quot exemplar -- quot' vec )
[ length ] keep new-resizable
[ [ push-all ] curry compose ] keep ; inline