prior
¶
v2 prior x prior[v2;x]
(vv)prior x prior[vv;x]
Where
v2
is a binary applicable valuevv
is a variadic applicable value
applies v2
or vv
to each item of x
and the item preceding it, and returns a result of the same length.
That is, the projections prior[v2;]
and prior[vv;]
are uniform functions.
q)(+) prior til 10
0 1 3 5 7 9 11 13 15 17
q){x+y%10}prior til 10
0n 1 2.1 3.2 4.3 5.4 6.5 7.6 8.7 9.8
prior
is a wrapper for the Each Prior iterator.
See the iterator for how the first item of the result is determined.
It is good q style to use prior
rather than the iterator, except where iterators are composed and brevity helps.