1(*
2    Title:      Standard Basis Library: Array Slice Signature
3    Author:     David Matthews
4    Copyright   David Matthews 1999, 2005, 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
20(* This uses the 'a array and 'a vector types defined at the top level.
21   It also uses the VectorSlice structure. *)
22signature ARRAY_SLICE =
23sig
24    type 'a slice
25    val length : 'a slice -> int
26    val sub : 'a slice * int -> 'a
27    val update : 'a slice * int * 'a -> unit
28    val full: 'a array -> 'a slice
29    val slice: 'a array * int * int option -> 'a slice
30    val subslice: 'a slice * int * int option -> 'a slice
31    val base: 'a slice -> 'a array * int * int
32    val vector: 'a slice -> 'a vector
33    val copy : {src : 'a slice, dst : 'a array, di : int} -> unit
34    val copyVec : {src : 'a VectorSlice.slice, dst : 'a array, di : int} -> unit
35    val isEmpty: 'a slice -> bool
36    val getItem: 'a slice -> ('a * 'a slice) option
37
38    val appi : (int * 'a -> unit) -> 'a slice -> unit
39    val app : ('a -> unit) -> 'a slice -> unit
40
41    val modifyi : (int * 'a -> 'a) -> 'a slice -> unit
42    val modify : ('a -> 'a) -> 'a slice -> unit
43
44    val foldli : ((int * 'a * 'b) -> 'b) -> 'b -> 'a slice -> 'b
45    val foldri : ((int * 'a * 'b) -> 'b) -> 'b -> 'a slice -> 'b
46    val foldl : (('a * 'b) -> 'b) -> 'b -> 'a slice -> 'b
47    val foldr : (('a * 'b) -> 'b) -> 'b -> 'a slice -> 'b
48    
49    val findi: (int * 'a -> bool) -> 'a slice -> (int * 'a) option
50    val find: ('a -> bool) -> 'a slice -> 'a option
51    
52    val exists: ('a -> bool) -> 'a slice -> bool
53    val all:  ('a -> bool) -> 'a slice -> bool
54    val collate: ('a * 'a -> order) -> 'a slice * 'a slice -> order
55end;
56