blob: de3059e0e8e8bad26cfb040a0d309291b6421f48 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import int;
append [] ys = ys;
append [x:xs] ys = [x:append xs ys];
flatten [] = [];
flatten [h:t] = append h (flatten t);
isEmpty [] = 1;
isEmpty _ = 0;
hd [x:_] = x;
tl [_:x] = x;
last [x:[]] = x;
last [_:xs] = last xs;
init [] = [];
init [x:[]] = [];
init [x:xs] = [x:init xs];
length_tl i [] = i;
length_tl i [_:xs] = length_tl (add 1 i) xs;
length xs = length_tl 0 xs;
repeat 0 _ = [];
repeat n x = [x:repeat (sub 1 n) x];
map f [] = [];
map f [x:xs] = [f x:map f xs];
|