fix errors
++ [1, 2, 3] [4, 5, 6]
-- fix
(++) [1, 2, 3] [4, 5, 6]
'<3' ++ ' Haskell'
--fix
"<3" ++ " Haskell"
concat ["<3", " Haskell"]
-- working
Print3Broken
can be fixed simply by moving greeting = "Yarrrrr"
to top level.
fix errors
concat [[1, 2, 3], [4, 5, 6]]
-- working
++ [1, 2, 3] [4, 5, 6]
-- fix
(++) [1, 2, 3] [4, 5, 6]
(++) "hello" " world"
-- working
["hello" ++ " world]
-- fix
["hello" ++ " world"]
4 !! "hello"
-- fix
"hello" !! 4
(!!) "hello" 4
-- working
take "4 lovely"
-- fix
take 4 "lovely"
take 3 "awesome"
-- working
pair code and results
-- a) - d)
concat [[1 * 6], [2 * 6], [3 * 6]]
[6,12,18]
-- b) - c)
"rain" ++ drop 2 "elbow"
"rainbow"
-- c) - e)
10 * head [1, 2, 3]
10
-- d) - a)
(take 3 "Julie") ++ (tail "yes")
"Jules"
-- e) - b)
concat [tail [1, 2, 3], tail [4, 5, 6], tail [7, 8, 9]]
[2,3,5,6,8,9]
-
list manipulations
-- a) "Curry is awesome" ++ "!" == "Curry is awesome!" -- b) "Curry is awesome!" !! 4 == "y" -- c) drop 9 "Curry is awesome!" == "awesome!"
-
same code in file
link:ch03_3.7_1.hs[role=include]
-
third letter
link:ch03_3.7_2.hs[role=include]
-
letter index
link:ch03_3.7_2_1.hs[role=include]
-
make reverse function using
drop
andtake
for a fixed input. this point includes point 6.link:ch03_3.7_3.hs[role=include]