jackfirth / rebellion

A collection of core libraries for Racket
https://pkgs.racket-lang.org/package/rebellion
Apache License 2.0
80 stars 16 forks source link

Add taking-local-maxima and taking-local-minima #503

Closed jackfirth closed 3 years ago

jackfirth commented 3 years ago

Note that for now these transducers just return the last element of plateaus, meaning that taking the local maxima of (1 2 2 1 3 3 1) yields (2 3) rather than (2 2 3 3). This can be changed in the future in a backwards-compatible way by adding an argument to these functions that supplies a transducer to send plateaus into, with the current behavior implemented by using a transducer that takes the last element. I didn't bother to implement this functionality because it's not yet clear to me what the use cases for it are.