Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /smlnj-lib/releases/release-110.61/Util/dynamic-array-sig.sml
ViewVC logotype

Annotation of /smlnj-lib/releases/release-110.61/Util/dynamic-array-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2253 - (view) (download)

1 : monnier 467 (* dynamic-array-sig.sml
2 :     *
3 :     * COPYRIGHT (c) 1999 Bell Labs, Lucent Technologies.
4 :     *
5 :     * Signature for unbounded polymorphic arrays.
6 :     *
7 :     *)
8 :    
9 :     signature DYNAMIC_ARRAY =
10 :     sig
11 :     type 'a array
12 :    
13 :     val array : (int * 'a) -> 'a array
14 :     (* array (sz, e) creates an unbounded array all of whose elements
15 :     * are initialized to e. sz (>= 0) is used as a
16 :     * hint of the potential range of indices. Raises Size if a
17 :     * negative hint is given.
18 :     *)
19 :    
20 :     val subArray : ('a array * int * int) -> 'a array
21 :     (* subArray (a,lo,hi) creates a new array with the same default
22 :     * as a, and whose values in the range [0,hi-lo] are equal to
23 :     * the values in b in the range [lo, hi].
24 :     * Raises Size if lo > hi
25 :     *)
26 :    
27 :     val fromList : 'a list * 'a -> 'a array
28 :     (* arrayoflist (l, v) creates an array using the list of values l
29 :     * plus the default value v.
30 :     *)
31 :    
32 :     val tabulate: (int * (int -> 'a) * 'a) -> 'a array
33 :     (* tabulate (sz,fill,dflt) acts like Array.tabulate, plus
34 :     * stores default value dflt. Raises Size if sz < 0.
35 :     *)
36 :    
37 :     val default : 'a array -> 'a
38 :     (* default returns array's default value *)
39 :    
40 :     val sub : ('a array * int) -> 'a
41 :     (* sub (a,idx) returns value of the array at index idx.
42 :     * If that value has not been set by update, it returns the default value.
43 :     * Raises Subscript if idx < 0
44 :     *)
45 :    
46 :     val update : ('a array * int * 'a) -> unit
47 :     (* update (a,idx,v) sets the value at index idx of the array to v.
48 :     * Raises Subscript if idx < 0
49 :     *)
50 :    
51 :     val bound : 'a array -> int
52 :     (* bound returns an upper bound on the index of values that have been
53 :     * changed.
54 :     *)
55 :    
56 :     val truncate : ('a array * int) -> unit
57 :     (* truncate (a,sz) makes every entry with index > sz the default value *)
58 :    
59 :     (** what about iterators??? **)
60 :    
61 :     end (* DYNAMIC_ARRAY *)
62 :    

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0