<exp>as well as what each element will be called
lt;name>. Note that the array has been splatted into its individual elements.
<init>, the starting value of the accumulator and
<block>, the expression that will update the accumulator for each element in the collection. Note that within the block expression,
.will evaluate to the current value of the accumulator.
yqis a little different from
yq(currently) isn't as sophisticated as
jqand its only supports infix notation (e.g. a + b, where the operator is in the middle of the two parameters) - where as
jquses a mix of infix notation with prefix notation (e.g.
reduce a bis like writing
+ a b).
ireducefor backwards compatability if a
jqlike prefix version of
reduceis ever added.