History

fix issue 9, add preliminary lists module

Charles.Forsyth committed 19 years ago

Commit 331b25a1 parent 6f2213610 files · +370 −6Browse files

Showing the changes to module (1 of 10 files). Show all

Unified · Split

module/lists.m+24−0
@@ -0,0 +1,24 @@
1Lists: module
2{
3 map: fn[T](f: ref fn(x: T): T, l: list of T): list of T;
4 allsat: fn[T](p: ref fn(x: T): int, l: list of T): int;
5 anysat: fn[T](p: ref fn(x: T): int, l: list of T): int;
6 filter: fn[T](p: ref fn(x: T): int, l: list of T): list of T;
7 partition: fn[T](p: ref fn(x: T): int, l: list of T): (list of T, list of T);
8
9 append: fn[T](l: list of T, x: T): list of T;
10 concat: fn[T](l: list of T, l2: list of T): list of T;
11 combine: fn[T](l: list of T, l2: list of T): list of T;
12 reverse: fn[T](l: list of T): list of T;
13 last: fn[T](l: list of T): T;
14 delete: fn[T](x: T, l: list of T): list of T
15 for { T => eq: fn(a, b: T): int; };
16 pair: fn[T1, T2](l1: list of T1, l2: list of T2): list of (T1, T2);
17 unpair: fn[T1, T2](l: list of (T1, T2)): (list of T1, list of T2);
18 ismember: fn[T](x: T, l: list of T): int
19 for { T => eq: fn(a, b: T): int; };
20};
21
22#sort?
23#join
24#split