Module Sequence.Expert
The functions in Expert
expose internal structure which is normally meant to be hidden. For example, at least when f
is purely functional, it is not intended for client code to distinguish between
List.filter xs ~f
|> Sequence.of_list
and
Sequence.of_list xs
|> Sequence.filter ~f
But sometimes for operational reasons it still makes sense to distinguish them. For example, being able to handle Skip
s explicitly allows breaking up some computationally expensive sequences into smaller chunks of work.
val next_step : 'a t -> ('a, 'a t) Step.t
next_step
returns the next step in a sequence's construction. It is likenext
, but it also allows observingSkip
steps.
val delayed_fold_step : 'a t -> init:'s -> f:('s -> 'a option -> k:('s -> 'r) -> 'r) -> finish:('s -> 'r) -> 'r
delayed_fold_step
is likeddelayed_fold
, butf
takes an option whereNone
represents aSkip
step.