[Haskell-cafe] New to Haskell - List Comprehension Question

2009-10-07 Thread Steven1990
Hi, I'm currently learning Haskell, and I've been trying to work out a function for the following problem for a couple of days now. I want to use a list comprehension method to change the first letter of a string to upper case, and the rest of the string to lower case. Eg: heLLo - Hello As

Re: [Haskell-cafe] New to Haskell - List Comprehension Question

2009-10-07 Thread Ross Mellgren
I don't think a list comprehension is the easiest way to do it, how about upperCase :: String - String upperCase [] = [] upperCase (x:xs) = toUpper x : map toLower xs -Ross On Oct 7, 2009, at 4:48 PM, Steven1990 wrote: Hi, I'm currently learning Haskell, and I've been trying to work out a

Re: [Haskell-cafe] New to Haskell - List Comprehension Question

2009-10-07 Thread Gregory Crosswhite
Hint: Move the boundary case outside the comprehension, and then use the comprehension to handle the normal case. Also, FYI, a comprehension feeds each value of the list xs into x, and then evaluates the expression to the left of the pipe with that single value of x. Cheers, Greg On

Re: [Haskell-cafe] New to Haskell - List Comprehension Question

2009-10-07 Thread minh thu
2009/10/7 Steven1990 stevenyoung1...@msn.com: Hi, I'm currently learning Haskell, and I've been trying to work out a function for the following problem for a couple of days now. I want to use a list comprehension method to change the first letter of a string to upper case, and the rest of

Re: [Haskell-cafe] New to Haskell - List Comprehension Question

2009-10-07 Thread michael rice
not...@gmail.com Subject: Re: [Haskell-cafe] New to Haskell - List Comprehension Question To: Steven1990 stevenyoung1...@msn.com Cc: haskell-cafe@haskell.org Date: Wednesday, October 7, 2009, 5:20 PM 2009/10/7 Steven1990 stevenyoung1...@msn.com: Hi, I'm currently learning Haskell, and I've been trying