Commit | Line | Data |
---|---|---|
ae4735db C |
1 | type ('a, 'b) view = |
2 | | Empty | |
34e49164 C |
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 | |
91eba41f C |
22 | method del2: 'a -> unit |
23 | method clear: unit | |
34e49164 C |
24 | |
25 | ||
26 | method fold : ('c -> 'a -> 'c) -> 'c -> 'c | |
27 | ||
28 | method fromlist : 'a list -> 'o | |
29 | method tolist : 'a list | |
30 | ||
31 | method exists : ('a -> bool) -> bool | |
32 | method filter : ('a -> bool) -> 'o | |
33 | ||
34 | method length : int | |
35 | ||
36 | method getone : 'a | |
37 | method others : 'o | |
38 | end |