qtspecs icon indicating copy to clipboard operation
qtspecs copied to clipboard

scan-left, scan-right: position argument, array functions

Open michaelhkay opened this issue 1 year ago • 4 comments

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.

michaelhkay avatar Jan 31 '24 08:01 michaelhkay