Bootstrapping definitions about arrays #
This file contains some definitions in Array
needed for Std.List.Basic
.
@[inline]
Like as.toList ++ l
, but in a single pass.
Equations
- Array.toListAppend as l = Array.foldr List.cons l as (Array.size as)
Instances For
ofFn f
with f : Fin n → α
returns the list whose ith element is f i
.
ofFn f = #[f 0, f 1, ... , f(n - 1)]
Equations
- Array.ofFn f = Array.ofFn.go f 0 (Array.mkEmpty n)
Instances For
Auxiliary for ofFn
. ofFn.go f i acc = acc ++ #[f i, ..., f(n - 1)]
Equations
- Array.ofFn.go f i acc = if h : i < n then Array.ofFn.go f (i + 1) (Array.push acc (f { val := i, isLt := h })) else acc