Calculemus


func<'a, 'b> Type

Type of polymorphic finite partial functions represented as a patricia tree, 'a being the type of the arguments and 'b that of the values.

Note

For a description of patricia trees see the article "Fast mergeable integer maps" by Chris Okasaki, Andy Gill - Workshop on ML, 1998.

Example

The following represents the function \(x \mapsto 1, y \mapsto 2, z \mapsto 3, w \mapsto 4\):

 Branch
   (0, 1, Leaf (2131634918, [("x", 1)]),
    Branch
      (1, 2, Leaf (147666021, [("w", 4)]),
       Branch
         (3, 4, Leaf (-1524676365, [("y", 2)]),
          Leaf (-1991064537, [("z", 3)]))))

Union cases

Union case Description

Branch(int, int, func<'a, 'b>, func<'a, 'b>)

Full Usage: Branch(int, int, func<'a, 'b>, func<'a, 'b>)

Parameters:
    Item1 : int - The prefix.
    Item2 : int - The branching bit.
    Item3 : func<'a, 'b> - The left branch.
    Item4 : func<'a, 'b> - The right branch.

Used to store more then one mapping.

Item1 : int

The prefix.

Item2 : int

The branching bit.

Item3 : func<'a, 'b>

The left branch.

Item4 : func<'a, 'b>

The right branch.

Example

Branch
 (3, 4,
 Leaf (-1524676365, [("y", 'b')]),
 Leaf (-1991064537, [("z", 'c')])
 )

Empty

Full Usage: Empty

Represents the empty, or everywhere undefined, FPF.

Leaf(int, ('a * 'b) list)

Full Usage: Leaf(int, ('a * 'b) list)

Parameters:
    Item1 : int - A generic hash used for comparison.
    Item2 : ('a * 'b) list - The pair of domain-codomain elements.

Represents a mapping from an element of the domain to an element of the codomain.

Item1 : int

A generic hash used for comparison.

Item2 : ('a * 'b) list

The pair of domain-codomain elements.

Example

Leaf (2131634918, [("x", 'a)]