From slide 30 to slide 37
@@ -0,0 +1,23 @@
+-- Reverse list order
+myexchanger xs zs = case xs of
+ [] -> zs
+ y:ys -> myexchanger ys (y:zs)
+
+myreverse xs = myexchanger xs []
+-- Delete the first item
+mydelete l y = case l of
+ [] -> []
+ x:xs -> if x == y then xs else x:(mydelete xs y)
+-- Find the maximum
+mymaximum l = mymaximumof l 0
+mymaximumof l x = case l of
+ [] -> x
+ y:ys -> if y > x then mymaximumof ys y else mymaximumof ys x
+-- Sort the list
+trimax l = if l == []
+ then []
+ else let y = mymaximum l in y:(trimax (mydelete l y))
@@ -0,0 +1,3 @@
+myflip::(a -> a -> b) -> a -> a -> b
+myflip f a1 a2 = f a2 a1
+square n = [(x, x * x) | x <- [1..n], x * x > 10]
+tripy n = [(a, b, c) | a <- [0..(div n 3)], b <- [(a + 1)..(div n 2)], c <- [(b + 1)..n], a^2 + b^2 == c^2, a + b + c == n]