Commit | Line | Data |
---|---|---|
34e49164 C |
1 | open Common |
2 | ||
3 | open Osequence | |
4 | ||
5 | (* growing array ? initialise with None, | |
6 | * and generate exception when not defined or have an arraydefault | |
7 | * update: can use dynArray ? | |
8 | *) | |
9 | ||
10 | (* !!take care!!, this is not a pure data structure *) | |
11 | class ['a] oarray n el = | |
12 | object(o: 'o) | |
13 | inherit ['a] osequence | |
14 | ||
15 | val data = Array.make n el | |
16 | ||
17 | method empty = raise Todo | |
18 | method add (i,v) = | |
19 | Array.set data i v; | |
20 | o | |
21 | ||
22 | method iter f = | |
23 | Array.iteri (curry f) data | |
24 | method view = raise Todo | |
25 | ||
26 | method assoc i = | |
27 | Array.get data i | |
28 | ||
29 | method null = raise Todo | |
30 | method nth = raise Todo | |
31 | method mem = raise Todo | |
32 | method last = raise Todo | |
33 | method first = raise Todo | |
34 | method delkey = raise Todo | |
91eba41f C |
35 | |
36 | method keys = raise Todo | |
37 | ||
34e49164 C |
38 | method del = raise Todo |
39 | method fromlist = raise Todo | |
40 | method length = | |
41 | Array.length data | |
42 | ||
43 | (* method create: int -> 'a -> 'o = | |
44 | raise Todo | |
45 | *) | |
46 | (* method put: make more explicit the fact that array do side effect *) | |
47 | end | |
48 |