Module Tabulate.ForIntSegment

ForIntSegment constructs a tabulator for the integer segment [0..n). An array is used to hold the table.

Parameters

module K : sig ... end

Signature

type key = int

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.