qtspecs
qtspecs copied to clipboard
scan-left, scan-right: position argument, array functions
We have added an optional position argument to nearly all callback functions that are invoked once for each item in a sequence. This argument is omitted from the new scan-left and scan-right functions. It should be added for consistency.
One of the proposed use cases for scan-left and scan-right is for debugging calls on fold-left and fold-right. This use case requires that the callback functions in the two cases are compatible.
Background note: the optional position argument is modelled on Javascript, where it is permitted in all the common higher-order functions such as filter
, forEach
, reduce
and reduceRight
(which are the Javascript equivalent of fold-left and fold-right). Javascript doesn't appear to offer an equivalent of scan-left
and scan-right
.