
Well, your function only remove space chars at string beginning. You may
use Prelude.words :: String -> [String] or some as:
http://haskell.org/hoogle/hoodoc.cgi?module=Prelude&name=words&mode=func
intoWords s = aux s []
2007/3/2, iliali16
Hi Haskell People, I have problem implementing one function. I think my idea is write but I have minor mistakes which I cannot get right since I progrem Haskell from very recently. No the function is called intoWords and has to take a string of any size and kind of characters.No I have to produce as output a list of strings.To have a rule which defines an element from the list is the space character which can also be included in the string.So what i think should be smth like. intoWord Hello my name is Smart should produse a list looking like [Hello,my,name,is,Smart] Now I tried to do it recucively to take the string and checks if an element is white space in the list using the isSPace build in function. This is my code please help me if you have any suggestions. Also I don't know how to produce a base case for my recursion.
import Char
intoWords ::String -> [String]
intoWords (x:xs) |isSpace x = intoWords xs |otherwise = xs
Thanks in advance for any suggestions. I really want to understand this bloody function couse I've been tring for a week now and I have tried so many ways to produce it that now I am fed up with it and I want to know how should it work since I am curious now.
-- View this message in context: http://www.nabble.com/Hi-I-need-help-for-very-simple-question%21-tf3334486.h... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe