]> hydra-www.ietfng.org Git - dyna2/commitdiff
Placeholder docs page for builtins
authorNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Sat, 15 Jun 2013 00:27:15 +0000 (20:27 -0400)
committerNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Tue, 18 Jun 2013 01:23:53 +0000 (21:23 -0400)
docs/sphinx/manual/builtins.rst [new file with mode: 0644]
docs/sphinx/manual/index.rst

diff --git a/docs/sphinx/manual/builtins.rst b/docs/sphinx/manual/builtins.rst
new file mode 100644 (file)
index 0000000..a154492
--- /dev/null
@@ -0,0 +1,58 @@
+.. Builtins
+   Here we describe the primitives available by default.
+
+********
+Builtins
+********
+
+Aggregators
+===========
+
+For aggregation, we offer
+
+* Numerics: ``max=``, ``min=``, ``+=`` (:math:`\sum`), ``*=`` (:math:`\prod`)
+* Logic: ``&=`` (:math:`\bigwedge`), ``|=`` (:math:`\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 :dynasrc:`here <examples/equalities.dyna>`).
+
+Constants
+=========
+
+Integers, floats, and double-quoted strings all exist as primtives in the
+language.  Booleans are represented by the atoms ``true`` and ``false``.
index 4f3dfa50ee770bc8da9225bd3fc8e7a15ef592e3..ecaf535df27c3d142e4937e6b3534acebb3c1a04 100644 (file)
@@ -7,3 +7,4 @@ User Manual
 .. toctree::
 
    pragmas
+   builtins