At 2001-05-02 01:34, Hannah Schroeter wrote:
How about this:
import Char(toUpper)
capitalize :: String -> String capitalize [] = [] capitalize (c:cs) = toUpper c : cs
capitalizeList :: [String] -> [String] capitalizeList = map capitalize
...or if you prefer... capitalizeList :: [String] -> [String] capitalizeList = map (map toUpper) -- Ashley Yakeley, Seattle WA
I am relatively new to Haskell. Somebody told me that it is a very good language, because all the people on its mailing list are so nice that they solve all homeworks, even quite silly, of all students around, provided they ask for a solution in Haskell. Is that true, or a little exaggerated? Jerzy Karczmarczuk
On Wed, 2 May 2001, Jerzy Karczmarczuk wrote:
I am relatively new to Haskell.
Somebody told me that it is a very good language, because all the people on its mailing list are so nice that they solve all homeworks, even quite silly, of all students around, provided they ask for a solution in Haskell.
Is that true, or a little exaggerated?
Not really. No one wants to answer my questions. :-) Do you think that this list is the only source of easy solutions? See what people ask Google and what Google sends to our web server: procedural+design+for+a+program+that+accepts+a+string +as+input+and+then+converts+all+upper+case+to+lower+case +and++vice-versa+and+prints+resulting+string+as+output Must be a tough and generic problem. Notice that Haskell is not mentioned here at all, but yet Google happily directed it to one of Haskell pages here. By the way, this is not the longest question that I've seen in the logs. Some are so long and weird that must match any web page out there. Jan
Hello! On Wed, May 02, 2001 at 01:42:55AM -0700, Ashley Yakeley wrote:
At 2001-05-02 01:34, Hannah Schroeter wrote:
capitalize (c:cs) = toUpper c : cs
capitalizeList = map capitalize
...or if you prefer...
capitalizeList :: [String] -> [String] capitalizeList = map (map toUpper)
I understood "capitalize" as toUpper only the *first* character of a string. Your capitalizeList at least isn't denotationally the same as mine. hannahCapitalizeList ["this", "is", "a", "fox"] === ["This", "Is", "A", "Fox"] ashleyCapitalizeList ["this", "is", "a", "fox"] === ["THIS", "IS", "A", "FOX"] Kind regards, Hannah.
participants (4)
-
Ashley Yakeley -
Hannah Schroeter -
Jan Skibinski -
Jerzy Karczmarczuk