From 0135b3ac0d41dda2a4c210e7c3989f20b672be5d Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Thu, 29 Jan 2015 16:29:05 +0800 Subject: p1+ p2 --- p1.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'p1.hs') diff --git a/p1.hs b/p1.hs index 3afd512..f0216c2 100644 --- a/p1.hs +++ b/p1.hs @@ -3,3 +3,7 @@ myLast :: [a] -> a myLast [] = error "Empty List" myLast [x] = x myLast (x:xs) = myLast xs + +myLast' = foldl1 (flip const) + +myLast'' = foldl1 (curry snd) -- cgit v1.2.3-70-g09d2