summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBruno <brunocauet@gmail.com>2013-07-01 17:18:15 +0200
committerBruno <brunocauet@gmail.com>2013-07-01 17:18:15 +0200
commit5d946b13faf2ef9cccaa5338da0ee218d8e06ae4 (patch)
tree4155e362db18e166f97fcde8acdf88e80d9f8708
parent2431545594963be4a79a2d4fbc79277fb30fef3b (diff)
Make myMap work on empty lists
Which is cleaner and the correct thing to do.
-rw-r--r--haskell.html.markdown2
1 files changed, 1 insertions, 1 deletions
diff --git a/haskell.html.markdown b/haskell.html.markdown
index f3baa9a5..134ea2a9 100644
--- a/haskell.html.markdown
+++ b/haskell.html.markdown
@@ -155,7 +155,7 @@ foo (x, y) = (x + 1, y + 2)
-- Pattern matching on arrays. Here `x` is the first element
-- in the array, and `xs` is the rest of the array. We can write
-- our own map function:
-myMap func [x] = [func x]
+myMap func [] = []
myMap func (x:xs) = func x:(myMap func xs)
-- Anonymous functions are created with a backslash followed by