Index Mathematics Conjectures nbv lettuce Widgets

shift

stdlib/shift.nbv

shift(static k, input)

Circularly shift the elements of a vector by index to input_i = input_{i - k mod (len! input)}

Precompiles
len!, loop_flat_map!, modulo!

Source

# Circularly shift the elements of a vector by index
# to input_i = input_{i - k mod (len! input)}
(static k, input)
static l = len! input
loop_flat_map! l, i {
  input[modulo! i + k, l]
}