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] )
module Infix : sig ... end