Commit | Line | Data |
---|---|---|
34e49164 C |
1 | type ('a, 'b) view = |
2 | | Empty | |
3 | | Cons of 'a * 'b | |
4 | ||
5 | class virtual ['a] ocollection : | |
6 | object ('o) | |
7 | inherit Objet.objet | |
8 | ||
9 | method virtual empty : 'o | |
10 | method virtual add : 'a -> 'o | |
11 | ||
12 | method virtual iter : ('a -> unit) -> unit | |
13 | method virtual view : ('a, 'o) view | |
14 | ||
15 | (* no need virtual, but better to force redefine for efficiency *) | |
16 | method virtual del : 'a -> 'o | |
17 | method virtual mem : 'a -> bool | |
18 | method virtual null : bool | |
19 | ||
485bce71 C |
20 | (* effect version *) |
21 | method add2: 'a -> unit | |
34e49164 C |
22 | |
23 | ||
24 | method fold : ('c -> 'a -> 'c) -> 'c -> 'c | |
25 | ||
26 | method fromlist : 'a list -> 'o | |
27 | method tolist : 'a list | |
28 | ||
29 | method exists : ('a -> bool) -> bool | |
30 | method filter : ('a -> bool) -> 'o | |
31 | ||
32 | method length : int | |
33 | ||
34 | method getone : 'a | |
35 | method others : 'o | |
36 | end |