Skip to content

Implement Ring.map_rev_shortcircuit #2

@rand00

Description

@rand00

As is noted here (though wrongly called Ring.find_map_rev), this function would be useful for performance-reasons when updating the Ring ring-buffer defined in lib/conntest.ml.

The performance gain will probably be relatively small as the ring-buffer is not too big, but it's nice to avoid unneccesary iteration.

The idea is that Ring has a primarily functional interface, and the new map_rev_shortcircuit would allow one to modify the ringbuffer starting from the latest added element, and stop iterating when None is returned by the given lambda.

The type would then be:

val map_rev_shortcircuit : ('a -> 'a option) -> 'a t -> 'a t

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions