Element selection from one-dimensional arrays

Uses
- One-dimensional arrays
- Logical truth

Elements of a one-dimensional array can be selected by providing a boolean mask:
s:𝕊, n:ℕ.nz, select(Array(𝔹, n), Array(s, n)) : Array1D(s)
select(EmptyArray1D, EmptyArray1D) : EmptyArray1D

For literal array terms, selection is implemented in Pharo:
s_:𝕊, n_:ℕ.nz, M:Array(𝔹, n_), A:Array(s_, n_), select(M, A) ⇒ Pharo:"M ensureArrayTerm. A ensureArrayTerm. A select: M"

Example

Uses example Integers

example select({[⊤, ⊥, ⊤, ⊥]}, {[1, 2, 3, 4]}) ⇒ {[1, 3]}