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

Steven1990 stevenyoung1990 at msn.com
Wed Oct 7 16:48:15 EDT 2009


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 I'm trying to learn this, I would appreciate hints rather than the
explicit solution if possible? I'm sure I'm close to a solution, I must be
missing something though. Driving me crazy! 

My attempts are something similar to this: 

upperCase :: String -> String 
upperCase xs = [toUpper(x):toLower(xs) | x <- xs] 

I think 'toLower' expects a single character rather than the list which is
one place I'm going wrong? 

Thanks in advance, 
Steven
-- 
View this message in context: http://www.nabble.com/New-to-Haskell---List-Comprehension-Question-tp25794144p25794144.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list