Import Upstream version 20180207
[hcoop/debian/mlton.git] / lib / mlton / basic / array.sig
1 (* Copyright (C) 2009 Matthew Fluet.
2 * Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
4 *
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
7 *)
8
9 signature ARRAY_STRUCTS =
10 sig
11 include VECTOR_STRUCTS
12
13 val update: 'a t * int * 'a -> unit
14 end
15
16 signature ARRAY =
17 sig
18 include VECTOR
19
20 val array: int * 'a -> 'a t (* synonym for new *)
21 val fromVector: 'a vector -> 'a t
22 val getAndSet: 'a t -> (int -> 'a) * (int * 'a -> unit)
23 val modify: 'a t * ('a -> 'a) -> unit
24 val shuffle: 'a t -> unit
25 (* Put random elements in the first n positions. *)
26 val shuffleN: 'a t * int -> unit
27 val swap: 'a t * int * int -> unit
28 val toVector: 'a t -> 'a vector
29 val toVectorMap: 'a t * ('a -> 'b) -> 'b vector
30 val update: 'a t * int * 'a -> unit
31 end