Definitions on Arrays #
This file contains various definitions on Array. It does not contain
proofs about these definitions, those are contained in other files in Std.Data.Array.
Drop nones from a Array, and replace each remaining some a with a.
Equations
- l.reduceOption = Array.filterMap id l 0
Instances For
Check whether xs and ys are equal as sets, i.e. they contain the same
elements when disregarding order and duplicates. O(n*m)! If your element type
has an Ord instance, it is asymptotically more efficient to sort the two
arrays, remove duplicates and then compare them elementwise.
Equations
Instances For
Returns the first minimal element among d and elements of the array.
If start and stop are given, only the subarray xs[start:stop] is
considered (in addition to d).
Equations
- xs.minWith d start stop = Array.foldl (fun (min x : α) => if (compare x min).isLT = true then x else min) d xs start stop
Instances For
Find the first minimal element of an array. If the array is empty, d is
returned. If start and stop are given, only the subarray xs[start:stop] is
considered.
Equations
Instances For
Find the first minimal element of an array. If the array is empty, none is
returned. If start and stop are given, only the subarray xs[start:stop] is
considered.
Equations
Instances For
Find the first minimal element of an array. If the array is empty, default is
returned. If start and stop are given, only the subarray xs[start:stop] is
considered.
Equations
- xs.minI start stop = xs.minD default start stop
Instances For
Returns the first maximal element among d and elements of the array.
If start and stop are given, only the subarray xs[start:stop] is
considered (in addition to d).
Equations
- xs.maxWith d start stop = xs.minWith d start stop
Instances For
Find the first maximal element of an array. If the array is empty, d is
returned. If start and stop are given, only the subarray xs[start:stop] is
considered.
Equations
- xs.maxD d start stop = xs.minD d start stop
Instances For
Find the first maximal element of an array. If the array is empty, none is
returned. If start and stop are given, only the subarray xs[start:stop] is
considered.
Equations
- xs.max? start stop = xs.min? start stop
Instances For
Find the first maximal element of an array. If the array is empty, default is
returned. If start and stop are given, only the subarray xs[start:stop] is
considered.
Equations
- xs.maxI start stop = xs.minI start stop
Instances For
O(1). "Attach" a proof P x that holds for all the elements of xs to produce a new array
with the same elements but in the type {x // P x}.
Equations
- xs.attachWith P H = { data := xs.data.attachWith P ⋯ }
Instances For
The empty subarray.
Equations
- Subarray.empty = { array := #[], start := 0, stop := 0, start_le_stop := Subarray.empty.proof_1, stop_le_array_size := Subarray.empty.proof_1 }
Instances For
Equations
- Subarray.instEmptyCollection_std = { emptyCollection := Subarray.empty }
Check whether a subarray contains an element.
Equations
- as.contains a = Subarray.any (fun (x : α) => x == a) as