From 6f604b19d3f5966e5c1d7c4fdf3703bd6ff0861c Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Thu, 16 Apr 2015 21:22:20 +0200 Subject: update to fp2 yay, public and licence --- fp1/week1/camil/2.1/NotatieFuncties.icl | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 fp1/week1/camil/2.1/NotatieFuncties.icl (limited to 'fp1/week1/camil/2.1/NotatieFuncties.icl') diff --git a/fp1/week1/camil/2.1/NotatieFuncties.icl b/fp1/week1/camil/2.1/NotatieFuncties.icl new file mode 100644 index 0000000..bab2054 --- /dev/null +++ b/fp1/week1/camil/2.1/NotatieFuncties.icl @@ -0,0 +1,39 @@ +module NotatieFuncties + +import StdEnv + +f1 :: Int +f1 = 1 + 5 + +f2 :: Int +f2 = (+) 1 5 + +f3 :: Int Int -> Int +f3 m n +| m < n = m +| otherwise = n + +f4 :: String Int -> String +f4 s n +| n <= 0 = "" +| otherwise = s +++ f4 s (n-1) + +f5 :: Int Int -> Int +f5 x 0 = x +f5 x y = f5 y (x rem y) + +f6 :: (Int,Int) -> Int +f6 x = fst x + snd x + +f7 :: (a,b) -> (b,a) +f7 (a,b) = (b,a) + +f8 :: (a,a) -> (a,a) +f8 x = f7 (f7 x) + +//Start = (f3 1 5, f3 4 3, f3 6 6) +//Start = f4 "ab" 4 +//Start = (f5 13 5, f5 8 4, f5 20 20) +//Start = f6 (2,3) +//Start = f7 (5,7) +Start = f8 (5,7) -- cgit v1.2.3