@@ -7,32 +7,32 @@ infixr 7 :: ;
7data List a = Nil | (::) a (List a);
7data List a = Nil | (::) a (List a);
9rev : List a -> List a;
9rev : List a -> List a;
10−rev xs = revAcc Nil xs where {
10+rev xs = revAcc [] xs where {
11 revAcc : List a -> List a -> List a;
11 revAcc : List a -> List a -> List a;
12− revAcc acc Nil = acc;
12+ revAcc acc [] = acc;
13 revAcc acc (x :: xs) = revAcc (x :: acc) xs;
13 revAcc acc (x :: xs) = revAcc (x :: acc) xs;
16length : List a -> Int;
16length : List a -> Int;
17−length Nil = 0;
17+length [] = 0;
18length (x :: xs) = 1 + length xs;
18length (x :: xs) = 1 + length xs;
20take : Int -> List a -> List a;
20take : Int -> List a -> List a;
21−take 0 xs = Nil;
21+take 0 xs = [];
22−take n Nil = Nil;
22+take n [] = [];
23take n (x :: xs) = x :: take (n-1) xs;
23take n (x :: xs) = x :: take (n-1) xs;
25drop : Int -> List a -> List a;
25drop : Int -> List a -> List a;
26drop 0 xs = xs;
26drop 0 xs = xs;
27−drop n Nil = Nil;
27+drop n [] = [];
28drop n (x :: xs) = drop (n-1) xs;
28drop n (x :: xs) = drop (n-1) xs;
30map : (a -> b) -> List a -> List b;
30map : (a -> b) -> List a -> List b;
31−map f Nil = Nil;
31+map f [] = [];
32map f (x :: xs) = f x :: map f xs;
32map f (x :: xs) = f x :: map f xs;
34filter : (y -> Bool) -> List y -> List y;
34filter : (y -> Bool) -> List y -> List y;
35−filter pred Nil = Nil;
35+filter pred [] = [];
36filter pred (x :: xs) with (pred x, filter pred xs) {
36filter pred (x :: xs) with (pred x, filter pred xs) {
37 filter pred (x :: xs) | (True, fxs) = x :: fxs;
37 filter pred (x :: xs) | (True, fxs) = x :: fxs;
38 filter pred (x :: xs) | (False, fxs) = fxs;
38 filter pred (x :: xs) | (False, fxs) = fxs;