[Haskell-cafe] Hi I need help for very simple question!

iliali16 iliali16 at gmail.com
Fri Mar 2 11:22:46 EST 2007

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.html#a9272506
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

More information about the Haskell-Cafe mailing list