summaryrefslogtreecommitdiff
path: root/H1.hs
diff options
context:
space:
mode:
Diffstat (limited to 'H1.hs')
-rw-r--r--H1.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/H1.hs b/H1.hs
new file mode 100644
index 0000000..f0216c2
--- /dev/null
+++ b/H1.hs
@@ -0,0 +1,9 @@
+
+myLast :: [a] -> a
+myLast [] = error "Empty List"
+myLast [x] = x
+myLast (x:xs) = myLast xs
+
+myLast' = foldl1 (flip const)
+
+myLast'' = foldl1 (curry snd)