jon.recoil.org

Module Transl_comprehension_utils.Cps_utils

val compose_map : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b

compose_map f xs applies f to every element of xs, obtaining a list of functions, and then composes these functions (from left to right). This is useful for, e.g., combining a sequence of translated clauses into a single lambda -> lambda function.

val compose_map_acc : ('a -> ('b -> 'b) * 'c) -> 'a list -> ('b -> 'b) * 'c list

compose_map_acc f xs is like compose_map, but f returns a pair of a function and some extra data; the final result is then the composition (as in compose_map) paired with the list of all these extra values. This is useful for combining a sequence of iterators into a single lambda -> lambda function and their list of generated bindings (a 'u Iterator_bindings.t list), as the binding function returns this extra data.