Adverbs are a third argument passed to binary operators that modifies how they iterate over SequenceableCollections or Streams. The idea for adverbs is taken from the J programming language which is a successor of APL.
Normally when you add two arrays like this:
You get this result:
A new array is created which is the length of the longer array and items from each array are added together by wrapped indexing.
Using adverbs can change this behavior. Adverbs are symbols and they follow a '.' (dot) after the binary operator. Adverbs can be applied to all binary operators.
The first adverb is 's' which means 'short'. The add operation now returns the shorter of the two arrays.
returns:
Another adverb is 'f' which uses folded indexing instead of wrapped:
returns:
The table adverb 't' makes an array of arrays where each item in the first array is added to the whole second array and the resulting arrays are collected.
returns:
The cross adverb 'x' is like table, except that the result is a flat array:
returns:
There is currently one adverb defined for streams. This is the cross adverb, 'x'.
Normally when you add two streams like this:
you get this:
The items are paired sequentially and the stream ends when the earliest stream ends.
The cross adverb allows you to pair each item in the first stream with every item in the second stream.
the result is:
You can string these together. Every item in the left stream operand is "ornamented" by the right stream operand.
Sound example: