[Haskell-cafe] returning lists
raptor
raptor at tvskat.net
Thu Dec 1 15:08:31 EST 2005
hi,
i'm having this problem, tring to implement split (for learning purposes).
Here is one sample of my tries :
split _ [] = []
split char (x:xs)
| x /= char = x : split char xs
| otherwise = []
it is ok i.e. it returns the first of the splits, but I want to get
all of the results.
str = "testingxsplitxtoxseexhowxitxwork"
*Main> split 'x' str
"testing"
I want :
["testing","split",...]
How do i do this.
More information about the Haskell-Cafe
mailing list