summaryrefslogtreecommitdiff
path: root/lec04/hw.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lec04/hw.hs')
-rw-r--r--lec04/hw.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/lec04/hw.hs b/lec04/hw.hs
new file mode 100644
index 0000000..1fbdd48
--- /dev/null
+++ b/lec04/hw.hs
@@ -0,0 +1,8 @@
+-- Exercise 1
+
+fun1 :: [Integer] -> Integer
+fun1 = product . map (\n -> n-2) . filter even
+
+-- not tested
+fun2 :: Integer -> Integer
+fun2 = until (== 1) fun2 . last . takeWhile odd . iterate (\n -> 3*n + 1) . sum . takeWhile even . iterate (`div` 2)