From 729c460112ca04e7fceee3508d6922362a24feb3 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sun, 19 Apr 2015 19:49:56 +0200 Subject: [PATCH] Add example on how a Haskeller would write this function --- VL2.tex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/VL2.tex b/VL2.tex index 3c81489..591ef68 100644 --- a/VL2.tex +++ b/VL2.tex @@ -494,6 +494,8 @@ square xs = map (\x -> x * x) xs absList :: [Int] -> [Int] absList xs = map (\x -> abs x) xs +-- a haskeller would write, GHCi... +absList = map abs \end{haskellcode} \pause Cool, right? So now we have abstracted out the \textbf{recursion pattern} that is all the same for those 3 functions. \code{map} is actually part of the standard library (called \emph{Prelude}).