[Haskell-cafe] returning lists

Ketil Malde ketil.malde at bccs.uib.no
Thu Dec 1 14:30:03 EST 2005


raptor <raptor at tvskat.net> writes:

> split _ [] = []
> split char (x:xs)
>         | x /= char = x : split char xs
>         | otherwise = []

> *Main> split 'x' str
> "testing"

> I want :
> ["testing","split",...]

> How do i do this.

Collect the read chars in a temp, when the separator is detected,
return the temp (probably reversing it) and recurse.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants



More information about the Haskell-Cafe mailing list