Builtins

Aggregators

For aggregation, we offer

  • Numerics: max=, min=, += (\(\sum\)), *= (\(\prod\))

  • Logic: &= (\(\bigwedge\)), |= (\(\bigvee\)).

  • A last-one-wins operation, :=. Formally, the last rule which contributes a value determines the head item’s value. That is, a program such as

    a := 1.
    a := 2 for d.
    

    will give a the value of 1 if d is not provable or is not true and 2 otherwise.

Functions

The following list of functions are guaranteed to be present, regardless of backend chosen:

  • The usual binary numeric operations: *, -, *, /, mod (or %), and ** (for raising to a power).
  • Some unary numeric operations: -, abs, log, and exp.
  • Comparison operators: <, <=, ==, >=, >, and != (disequality).
  • Logic operations: and (or &), or (or |), ^ (for exclusive or), and not (or !).
  • Unification is written =. Prolog’s is operator is also available.

Warning

The distinction between = and == is that the latter evaluates both of its arguments while the former does not. Meanwhile, is is asymmetric, evaluating its right argument and not its left.

See examples/equalities.dyna (or here).

Constants

Integers, floats, and double-quoted strings all exist as primtives in the language. Booleans are represented by the atoms true and false.