Add a skiparray_fold function, which sequentially iterates over one or more skiparrays, calling a merge callback to choose which key/value pair to use when the next keys from multiple skiparrays compare equal. Left and right fold would correspond to forward and backward iteration.
Because this will probably have several options (an array of skiparrays, a skiparray count, a LEFT or RIGHT argument, merge callback, apply callback, etc.), there could probably be wrapper functions for common cases, like left-fold over a single skiparray in one pass.
This could be incremental, with a simpler one-pass wrapper. Since it will use the iteration interface internally, the skiparray(s) will already be locked until fold completes.
Add a
skiparray_fold
function, which sequentially iterates over one or more skiparrays, calling a merge callback to choose which key/value pair to use when the next keys from multiple skiparrays compare equal. Left and right fold would correspond to forward and backward iteration.Because this will probably have several options (an array of skiparrays, a skiparray count, a
LEFT
orRIGHT
argument, merge callback, apply callback, etc.), there could probably be wrapper functions for common cases, like left-fold over a single skiparray in one pass.This could be incremental, with a simpler one-pass wrapper. Since it will use the iteration interface internally, the skiparray(s) will already be locked until fold completes.