Prefix | m\ u\ _ 0 _ | Infix |
u\y has #y items resulting from
applying u to each of the prefixes k{.y ,
for k from 1 to #y . m\y applies successive verbs from the gerund m to the prefixes of y , extending m cyclically as required. |
If x>:0 , the items of x u\ y
result from applying u to each infix of
length x . If x<0 , u
is applied to non-overlapping infixes of length |x
, including any final shard. x m\ y applies successive verbs from the gerund m to the infixes of y , extending m cyclically as required. |
+/\a=: 1 2 4 8 16 NB. Subtotals, or partial sums 1 3 7 15 31 */\a NB. Partial products 1 2 8 64 1024 <\a +-+---+-----+-------+----------+ |1|1 2|1 2 4|1 2 4 8|1 2 4 8 16| +-+---+-----+-------+----------+ <\i.3 4 +-------+-------+---------+ |0 1 2 3|0 1 2 3|0 1 2 3| | |4 5 6 7|4 5 6 7| | | |8 9 10 11| +-------+-------+---------+ (+/\^:_1 +/\ a) ,: */\^:_1 a 1 2 4 8 16 1 2 2 2 2The following examples illustrate the use of the dyad infix:
(2 -/\ ]) a NB. Backward differences _1 _2 _4 _8 (2 -~/\ ]) a NB. Forward differences 1 2 4 8 3 <\ 'abcdefgh' +---+---+---+---+---+---+ |abc|bcd|cde|def|efg|fgh| +---+---+---+---+---+---+ _3 <\ 'abcdefgh' +---+---+--+ |abc|def|gh| +---+---+--+