xref: /inferno-os/module/sets.m (revision 46439007cf417cbd9ac8049bb4122c890097a0fa)
1Sets: module {
2	A: con 2r1010;
3	B: con 2r1100;
4
5	PATH: con "/dis/lib/sets.dis";
6
7	init:		fn();
8	set:		fn(): Set;
9	str2set:	fn(str: string): Set;
10	bytes2set:	fn(d: array of byte): Set;
11	Set: adt {
12		m:	int;
13		a:	array of int;
14
15		X:		fn(s1: self Set, o: int, s2: Set): Set;
16		add:		fn(s: self Set, n: int): Set;
17		addlist:	fn(s: self Set, ns: list of int): Set;
18		# dellist:	fn(s: self Set, ns: list of int): Set;
19		del:		fn(s: self Set, n: int): Set;
20		invert:	fn(s: self Set): Set;
21
22		eq:		fn(s1: self Set, s2: Set): int;
23		holds:	fn(s: self Set, n: int): int;
24		isempty:	fn(s: self Set): int;
25		msb:		fn(s: self Set): int;
26		limit:		fn(s: self Set): int;
27
28		str:		fn(s: self Set): string;
29		bytes:	fn(s: self Set, n: int): array of byte;
30		debugstr:	fn(s: self Set): string;
31	};
32	All: con Set(~0, nil);
33	None: con Set(0, nil);
34};
35