diff options
author | Adam Bard <github@adambard.com> | 2013-07-01 08:43:11 -0700 |
---|---|---|
committer | Adam Bard <github@adambard.com> | 2013-07-01 08:43:11 -0700 |
commit | adaf4908a08da43006e7ad1074ccc50435e095fb (patch) | |
tree | c6445c8483957f357bcc12227010a6f59c480c0e | |
parent | cf9273a4fd7d398569a530a6d34fa8c107d2b1e3 (diff) | |
parent | 5d946b13faf2ef9cccaa5338da0ee218d8e06ae4 (diff) |
Merge pull request #74 from brunal/patch-1
Make myMap work on empty lists
-rw-r--r-- | haskell.html.markdown | 2 |
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 |