From 5d946b13faf2ef9cccaa5338da0ee218d8e06ae4 Mon Sep 17 00:00:00 2001 From: Bruno Date: Mon, 1 Jul 2013 17:18:15 +0200 Subject: Make myMap work on empty lists Which is cleaner and the correct thing to do. --- haskell.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3