tupelo.vec
coerce->vec
(coerce->vec arg)
Inputs: [arg]
Returns: tsk/Vec
Coerce any scalar values to a vector
del
(del src idxs)
Inputs: [src :- tsk/Vec idxs :- IndexSpec]
Returns: tsk/Vec
Delete elements at the specified indexes.
get
(get src idxs)
Inputs: [src :- tsk/Vec idxs :- IndexSpec]
Returns: tsk/Vec
Given a source vector V and a list of index values `idx`, returns a vector: [ V(idx-1) V(idx-2) ...]
pred-index
(pred-index pred coll)
Given a predicate fn and a collection of values, returns the index values for which the
predicate is true & false like:
(pred-index #(zero? (rem % 3)) [0 10 20 30 40 50 60 70 80])
=> {:idxs-true [0 3 6]
:idxs-false [1 2 4 5 7 8] }
set
(set dest idxs src)
Inputs: [dest :- tsk/Vec idxs :- IndexSpec src :- tsk/Vec]
Returns: tsk/Vec
Given a dest vector V, a list of index values `idx`, and a conforming src vector,
returns a modified V such that V(idx-j) = src[j] for j in [0..len(idx)]
set-lax
(set-lax dest idxs src)
Inputs: [dest :- tsk/Vec idxs :- IndexSpec src :- s/Any]
Returns: tsk/Vec
Like vec-put-idxs, but is lax in accepting the src vector. If a scalar is supplied,
it is replaced with `(repeat <src>)`. If the src vector is longer than the idxs, it is truncated
to conform.
validate-indexes-complete
(validate-indexes-complete idxs)
Inputs: [idxs]
Returns: s/Any
Validates that a collection of N index values includes all values in [0..N).
verify-idxs
(verify-idxs tgt idxs)
Inputs: [tgt :- tsk/Vec idxs :- [s/Int]]
Assets that an integer index is non-negative and less than a bound