Mappings

The following code examples demonstrate how a mapping can be declared and used. See section [TBD] for details.

Declaration

Some Record to Int: (r) => r(Value A).
Int to Some Record: (i) => {Value A [i], Value B [0]}.
Int per (Int => Int) to Some Record: (i, mapping) => 
    {Value A [i], Value B [i -> mapping]}.
Some Record to alt Int: (r) => r(Value B).
Some Record with Int to Int: (r, i) => r(Value A) + i.
Some Record to {Int, Int}: (r) => {r(Value A), r(Value B)}.
Some Record with Int to {Int, Int}: (r, i) => {r(Value A) + i, r(Value B) + i}.
{Int*} to half sum Int: (list) => list mapped to Int by [(i, sum) => sum + i] / 2.
{Int*} to doubled {Int*}: (list) => list mapped by [(i) => i * 2].
{Int*} with (Int => String) to {String*}: (list, mapping) => list mapped by mapping.
Int to Some Enum: (i) ??
    i = 0 => Some Enum (A),
    i = 1 => Some Enum (B),
    i = 2 => Some Enum (C),
    default => Some Enum (A).
Some Enum to Other Enum: (e) ??
    e = A => Other Enum (X),
    e = B => Other Enum (Y),
    e = C => Other Enum (Z),
    default => Other Enum (X).

With Identifiers

With Replacements

Use

Last updated