Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
15
Task/Multisplit/Factor/multisplit.factor
Normal file
15
Task/Multisplit/Factor/multisplit.factor
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
USING: arrays fry kernel make sequences ;
|
||||
|
||||
IN: rosetta-code.multisplit
|
||||
|
||||
: first-subseq ( seq separators -- n separator )
|
||||
tuck
|
||||
[ [ subseq-index ] dip 2array ] withd map-index sift-keys
|
||||
[ drop f f ] [ [ first ] infimum-by first2 rot nth ] if-empty ;
|
||||
|
||||
: multisplit ( string separators -- seq )
|
||||
'[
|
||||
[ dup _ first-subseq dup ] [
|
||||
length -rot cut-slice [ , ] dip swap tail-slice
|
||||
] while 2drop ,
|
||||
] { } make ;
|
||||
Loading…
Add table
Add a link
Reference in a new issue