Module Tabulate.Make

Make constructs a tabulator for a finite type that is equipped with an implementation of imperative maps.


module F : sig ... end
module M : sig ... end


type key = F.t

The type of keys.

val tabulate : (key -> 'a) -> key -> 'a

tabulate is a tabulation combinator for the type key. The function call tabulate f produces a function f' that behaves extensionally like f, but is tabulated.

Like memoization, tabulation guarantees that, for every key x, the image f x is computed at most once. Unlike memoization, where this computation takes place on demand, here, the computation of f x for every x takes place eagerly, when tabulate is invoked. The graph of the function f, a table, is constructed and held in memory.