xref: /inferno-os/module/lists.m (revision 09fa9b42130335ddb8876b9be05f780093519864)
1Lists: module
2{
3	PATH:	con "/dis/lib/lists.dis";
4	map:	fn[T](f: ref fn(x: T): T, l: list of T): list of T;
5	allsat:	fn[T](p: ref fn(x: T): int, l: list of T): int;
6	anysat:	fn[T](p: ref fn(x: T): int, l: list of T): int;
7	filter:	fn[T](p: ref fn(x: T): int, l: list of T): list of T;
8	partition:	fn[T](p: ref fn(x: T): int, l: list of T): (list of T, list of T);
9
10	append:	fn[T](l: list of T, x: T): list of T;
11	concat:	fn[T](l: list of T, l2: list of T): list of T;
12	combine:	fn[T](l: list of T, l2: list of T): list of T;
13	reverse:	fn[T](l: list of T): list of T;
14	last:		fn[T](l: list of T): T;
15	find:		fn[T](x: T, l: list of T): list of T
16		for { T => eq:	fn(a, b: T): int; };
17	delete:	fn[T](x: T, l: list of T): list of T
18		for { T => eq:	fn(a, b: T): int; };
19	pair:	fn[T1, T2](l1: list of T1, l2: list of T2): list of (T1, T2);
20	unpair:	fn[T1, T2](l: list of (T1, T2)): (list of T1, list of T2);
21	ismember:	fn[T](x: T, l: list of T): int
22		for { T =>	eq:	fn(a, b: T): int; };
23};
24
25#sort?
26#join
27#split
28