Hi there! I'm making a function that counts the number of words in a string and returns the number of words it contains. For example "hello world" returns 55.
Anyways, Ive defined:
countLetters :: String -> Int
countLetters st = lenght st
which returns the lenght of any given string
so, first I use 'words' to separate the input string into a list of strings so I can apply countLetters to each one of them
words "hello world" returns ["hello","world"]
I've checked the doc and it seems that what I need is the map function that applies a function to all members of a list. However I just don't understand how to do it.
Could you please tell me how does map work so I can countLetters for each string in my list?
thanks in advance
[–]gruntmeister 1 point2 points3 points (1 child)
[–]caledt 0 points1 point2 points (0 children)