silentbicycle / skiparray

unrolled skip list library for C
ISC License
21 stars 2 forks source link

Merge/filter (name TBD) #3

Closed silentbicycle closed 5 years ago

silentbicycle commented 5 years ago

A merge/filter function, built on top of fold, which takes one or more skiparrays, an optional merge callback, and an optional predicate, and returns a newly constructed skiparray (or a memory or misuse error).

Calling with multiple skiparrays and no merge callback would be a misuse error. Calling with a single skiparray and no predicate would effectively be a copy; with a predicate it'd be filter.

Because this would be iteration-based, the other skiparray(s) would be locked until the function completes. This would probably run in one-pass.

This needs a better name than merge_filter. Something more like build_from (but ending in "from" is awkward), extract (except it doesn't modify the original(s)), select (but without the SQL baggage)?