1(*
2    Title:      Standard Basis Library: Array Signature
3    Author:     David Matthews
4    Copyright   David Matthews 2016
5
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License version 2.1 as published by the Free Software Foundation.
9    
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14    
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18*)
19
20signature ARRAY =
21sig
22    eqtype 'a array
23    type 'a vector
24
25    val maxLen : int
26    val array : (int * 'a) -> 'a array
27    val fromList : 'a list -> 'a array
28    val vector: 'a array -> 'a vector
29    val tabulate : (int * (int -> 'a)) -> 'a array
30    val length : 'a array -> int
31    val sub : ('a array * int) -> 'a
32    val update : ('a array * int * 'a) -> unit
33    val copy : {src : 'a array, dst : 'a array, di : int} -> unit
34    val copyVec : {src : 'a vector, dst : 'a array, di : int} -> unit
35
36    val appi : ((int * 'a) -> unit) -> 'a array -> unit
37    val app : ('a -> unit) -> 'a array -> unit
38
39    val foldli : ((int * 'a * 'b) -> 'b) -> 'b -> 'a array -> 'b
40    val foldri : ((int * 'a * 'b) -> 'b) -> 'b -> 'a array -> 'b
41    val foldl : (('a * 'b) -> 'b) -> 'b -> 'a array -> 'b
42    val foldr : (('a * 'b) -> 'b) -> 'b -> 'a array -> 'b
43
44    val modifyi : ((int * 'a) -> 'a) -> 'a array -> unit
45    val modify : ('a -> 'a) -> 'a array -> unit
46
47    val findi: (int * 'a -> bool) -> 'a array -> (int * 'a) option
48    val find: ('a -> bool) -> 'a array -> 'a option
49    val exists: ('a -> bool) -> 'a array -> bool
50    val all: ('a -> bool) -> 'a array -> bool
51    val collate: ('a * 'a -> order) -> 'a array * 'a array -> order
52end;
53