choice

Choice monad, for easy backtracking
IN THIS PACKAGE
Module Choice . Enum
type 'a t

Enumerate values of type 'a, with a choice point for each value

type 'a item =
| End
| Item of 'a * 'a t
val next : 'a t -> 'a item choice

choose the next element

val empty : 'a t

Empty iterator

val cons : 'a choice -> 'a t -> 'a t

Add an element at the head of the list

val cons1 : 'a -> 'a t -> 'a t

deterministic cons

val of_list : 'a list -> 'a t

Simply enumerate the elements of the list

val zip : 'a t -> 'b t -> ('a * 'b) t

Combine every element of the first enumeration with every element at the same position in the second enumeration. The result always ends at soon as one of the enumeration ends

val count : _ t -> int

Number of distincts enumerations

val to_lists : 'a t -> 'a list choice

Conversion to a choice of lists

val to_list_list : 'a t -> 'a list list

Conversion to a list of possibilies