| 1 |
(* Copyright (C) 2017 Matthew Fluet. |
| 2 |
* Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh |
| 3 |
* Jagannathan, and Stephen Weeks. |
| 4 |
* Copyright (C) 1997-2000 NEC Research Institute. |
| 5 |
* |
| 6 |
* MLton is released under a HPND-style license. |
| 7 |
* See the file MLton-LICENSE for details. |
| 8 |
*) |
| 9 |
|
| 10 |
structure Vector: VECTOR_EXTRA = |
| 11 |
struct |
| 12 |
structure V = Sequence (Primitive.Vector) |
| 13 |
open V |
| 14 |
|
| 15 |
type 'a vector = 'a vector |
| 16 |
|
| 17 |
structure VectorSlice = |
| 18 |
struct |
| 19 |
open Slice |
| 20 |
type 'a vector = 'a vector |
| 21 |
val vector = sequence |
| 22 |
|
| 23 |
val isSubvector = isSubsequence |
| 24 |
val span = fn (sl, sl') => |
| 25 |
Primitive.Vector.Slice.span |
| 26 |
(op = : ''a vector * ''a vector -> bool) |
| 27 |
(sl, sl') |
| 28 |
end |
| 29 |
|
| 30 |
fun update (v, i, x) = |
| 31 |
(Primitive.Vector.updateVector (v, SeqIndex.fromInt i, x)) |
| 32 |
handle Overflow => raise Subscript |
| 33 |
|
| 34 |
val isSubvector = isSubsequence |
| 35 |
|
| 36 |
val unsafeFromArray = Primitive.Vector.unsafeFromArray |
| 37 |
|
| 38 |
val vector = new |
| 39 |
end |
| 40 |
structure VectorSlice: VECTOR_SLICE_EXTRA = Vector.VectorSlice |
| 41 |
|
| 42 |
structure VectorGlobal: VECTOR_GLOBAL = Vector |
| 43 |
open VectorGlobal |
| 44 |
val vector = Vector.fromList |