Multisplit: Difference between revisions

Content added Content deleted
(→‎{{header|Python}}: Added a functionally composed draft (using reduce, without regexes))
m (→‎{{header|Factor}}: A small optimization in best-separator: no need to filter if we only need to take the first element of the result, might as well just find the first matching one.)
Line 522: Line 522:


: best-separator ( seq -- pos index )
: best-separator ( seq -- pos index )
dup [ first ] map infimum '[ first _ = ] filter first first2 ;
dup [ first ] map infimum '[ first _ = ] find nip first2 ;


: first-subseq ( separators seq -- n separator )
: first-subseq ( separators seq -- n separator )