List of words

Hannah Schroeter uk1o@rz.uni-karlsruhe.de
Wed, 2 May 2001 10:34:31 +0200


Hello!

On Wed, May 02, 2001 at 01:31:54AM -0700, lynn yeong wrote:
> Hi, I'm fairly new to Haskell, and recently I came upon a question which asks to capitalise all words in a given list. I haveno idea how to do it, can you help? Thanks!

[please wrap your lines!]

How about this:

import Char(toUpper)

capitalize :: String -> String
capitalize [] = []
capitalize (c:cs) = toUpper c : cs

capitalizeList :: [String] -> [String]
capitalizeList = map capitalize

Kind regards,

Hannah.