修訂 | 109cd5029a3aa16a15098a1bb0184f89ffbd6803 (tree) |
---|---|
時間 | 2010-09-08 22:33:11 |
作者 | lorenzo |
Commiter | lorenzo |
I expanded a tiny bit the hello world example.
@@ -1,3 +1,6 @@ | ||
1 | +import Data.Char | |
2 | + | |
3 | + | |
1 | 4 | main = do |
2 | 5 | putStrLn "Hello, what's your name?" |
3 | 6 | name <- getLine |
@@ -8,3 +11,21 @@ | ||
8 | 11 | -- name <- getLine |
9 | 12 | -- putStrLn $ "Read this carefully, because this is your future: " ++ tellFortune name |
10 | 13 | |
14 | + | |
15 | +-- main_bis = do | |
16 | + putStrLn "What's your first name?" | |
17 | + firstName <- getLine | |
18 | + putStrLn "What's your last name?" | |
19 | + lastName <- getLine | |
20 | + let bigFirstName = map toUpper firstName | |
21 | + bigLastName = map toUpper lastName | |
22 | + putStrLn $ "hey " ++ bigFirstName ++ " " ++ bigLastName ++ ", how are you?" | |
23 | + | |
24 | +-- f :: [String] -> [Int] | |
25 | +-- f = map read | |
26 | + | |
27 | + | |
28 | +-- c = f(["1","2"]) | |
29 | + | |
30 | +-- let f putStrLn c | |
31 | +-- print f | |
\ No newline at end of file |