Module Maki.Arg

To memoize a function, Maki must be able to hash the function's input arguments. Arguments that hash to the same value are considered identical. We use a cryptographic hash to ensure that the probability of collisions is astronomically low.

An argument is then the pair of the value and its hash function; if the result is stored (by the computation's hash), we return it, otherwise we compute the value.

Example: to pass a int list as argument:

      Arg.(Hash.(list int) @:: [41; 0; 1] )
type t =
| A : 'a Hash.t * 'a ‑> t

(** A pair of a value (in case we need to compute) and a hash function (to check whether a result is computed already).

Typically one would use @:::

  • int @:: 42
  • list string @ ["a"; "b"]

*)

val make : 'a Hash.t ‑> 'a ‑> t
module Infix : sig ... end
include module type of Infix
val (@::) : 'a Hash.t ‑> 'a ‑> t

Infix alias to make