summaryrefslogtreecommitdiff
path: root/1-10/2.hs
diff options
context:
space:
mode:
Diffstat (limited to '1-10/2.hs')
-rw-r--r--1-10/2.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/1-10/2.hs b/1-10/2.hs
new file mode 100644
index 0000000..baeb995
--- /dev/null
+++ b/1-10/2.hs
@@ -0,0 +1,4 @@
+myButLast [] = error "empty list"
+myButLast [x] = error "list with single element"
+myButLast (x:[y]) = x
+myButLast (x:xs) = myButLast xs