Index Mathematics Conjectures nbv lettuce Widgets

size_cyclic

stdlib/size_cyclic.nbv

size_cyclic(l, v)

given a vector v, extend to length l by repetition, or truncate if l is shorter than len! v.

Precompiles
len!, loop_flat_map!, modulo!

Source

# given a vector `v`, extend to length
# `l` by repetition, or truncate if `l`
# is shorter than `len! v`.
(l, v)
static v_len = len! v
loop_flat_map! l, i {
  v[modulo! i, v_len]
}