bab205422936b764ce6e821b1e0fc039d2f023bb
[fp1415.git] / camil / 2.1 / NotatieFuncties.icl
1 module NotatieFuncties
2
3 import StdEnv
4
5 f1 :: Int
6 f1 = 1 + 5
7
8 f2 :: Int
9 f2 = (+) 1 5
10
11 f3 :: Int Int -> Int
12 f3 m n
13 | m < n = m
14 | otherwise = n
15
16 f4 :: String Int -> String
17 f4 s n
18 | n <= 0 = ""
19 | otherwise = s +++ f4 s (n-1)
20
21 f5 :: Int Int -> Int
22 f5 x 0 = x
23 f5 x y = f5 y (x rem y)
24
25 f6 :: (Int,Int) -> Int
26 f6 x = fst x + snd x
27
28 f7 :: (a,b) -> (b,a)
29 f7 (a,b) = (b,a)
30
31 f8 :: (a,a) -> (a,a)
32 f8 x = f7 (f7 x)
33
34 //Start = (f3 1 5, f3 4 3, f3 6 6)
35 //Start = f4 "ab" 4
36 //Start = (f5 13 5, f5 8 4, f5 20 20)
37 //Start = f6 (2,3)
38 //Start = f7 (5,7)
39 Start = f8 (5,7)