Multisplit: Difference between revisions

Content added Content deleted
m (→‎{{header|Haskell}}: (Pruned out a couple of redundant imports))
Line 688: Line 688:
then Nothing
then Nothing
else find (`isPrefixOf` drop i s) ds) of
else find (`isPrefixOf` drop i s) ds) of
Just x -> ([], mappend parts [(tokens, x, i)], i + length x)
Just x -> ([], (tokens, x, i) : parts, i + length x)
Nothing ->
Nothing ->
( mappend
( if inDelim
tokens
then tokens
(if inDelim
else c : tokens
then []
else [c])
, parts
, parts
, offset))
, offset))
([], [], 0)
([], [], 0)
(zip s [0 .. lng])
(zip s [0 .. lng])
in mappend ps [(ts, [], lng)]
in reverse $ (ts, [], lng) : ps


main :: IO ()
main :: IO ()