a language for data transformation.
note: this is extremely wip and subject to change
Integer (bigint)Float (double), when numeric literal includes a periodInfinityString within double quotesEmpty type (initial object, no inhabitants)() type (terminal object, singleton inhabitant)AnythingIdentifierType types (values that depend on Type are not themselves in Type)+, -, *, /, ^ (exponentiation) with their usual math sense for integers and rationals>, <, >=, <=, =, =/= comparisons+ string concatenationand, or, not(, ) order of operationsx is a literal, it is equivalent to () := x, which is a function that maps () to xx := y is a function that maps the value x to the value ya : b := c, where either : b or := c can be skipped
: b is a type annotation, which checks compile-time if b subtypes c. it is inferred if skippeda isn’t required to be a simple value, and mapping evaluation is done by pattern matchinga is a simple identifier, it will be taken as a value of Identifier type:=), it is considered partial and it cannot be called
a, that identifier will bind to the value
a can be used directly within the outer kv pair(a : Integer) := a * 2. note the parentheses, as the structure is (map) := result*identifier is sugar for identifier : (), operator creates a product function of two existing functions
a := b, c := d will create a new function which maps a to b and c to d() to a value (i.e. is a standalone value), the behavior is different:
1, 2, 3 to be semantically equivalent to 0 : 1, 1 : 2, 2 : 3, i.e. allows lists| operator creates a coproduct (sum) partial function
a := b | c := d is partial because it could map a to b or c to d, but it is not known which() key rule applies as for the , operatora & b merges two maps, that is, it creates the smallest map that supertypes both, and errs if it’s not possiblef m applies a map to a function
kv in m, it replaces the definition of all kv pairs that supertype it in the function domain with kvf := (x : Integer, y : Integer) := x + y, f (x := 5) is (x : Integer := 5, y : Integer) := x + yf! evaluates a function
() := value function)f[x] evaluates a function for a specific value, matched to the first kv pair whose key it subtypes
map[key]^ f transforms a map into a positional map, which can be pattern-matched by positional arguments
^(x : Int, y : Int) will match to (1, 2) as ^(x : Int := 1, y : Int := 2)nonposmap & posmap will also generate a map that is mixed positional - non-positional,a :: b -> c is sugar for a := b := c, for claritya @ b is sugar for (^a) b!. if a is already positional, applying ^ doesn’t change anything$a retrieves the Identifier value equal to a, instead of the value of a
a.b is syntactic sugar for a[$b]a := b represent the value at a, it needs to be a full expression, such as Id@aId := ^(x : Anything) := x)
Boolean := *True | *False
Maybe :: type : Type -> Just : type | *Nothing
myValue := (Maybe@Integer).Just@7
Tree :: type : Type -> left : Tree@type, right : Tree@type | *Nothing
List :: type : Type -> () | ^(value : type) & List@type
Kwargs :: type : Type -> ^(ids : List@(Identifier : type))
Dummy :: x : Integer & Kwargs@String -> ids