summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/precedent.127
1 files changed, 21 insertions, 6 deletions
diff --git a/doc/precedent.1 b/doc/precedent.1
index 1365ee8..a9c64e2 100644
--- a/doc/precedent.1
+++ b/doc/precedent.1
@@ -40,7 +40,10 @@ are examples of literal values: [ 123, "hello world", 9.81 ]. A key without argu
is simply stated as a word. The following are examples of key references:
[ myVar, arg0 ]. A key reference may have any number of arguments, which may be
literals or key references. The following are examples of key references with arguments:
-[ print("hello world"), print(myVar), print(eq(1, 2)) ].
+[ print("hello world"), print(myVar), print(eq(1, 2)) ]. Literals and keys may be separated by commas, semicolons, or spaces, to taste.
+
+.SH DETAILS
+Logical functions treat all non-zero integer values as TRUE, and 0 as FALSE. Passing a float or a string to such a function will usually result in an error. Some logical functions short-circuit, meaning that they will cease evaluation as soon as their condition can no longer be met. For example, if the first argument to all() is FALSE, it will not evaluate the rest of its arguments.
.SH FUNCTIONS
\fBroot() OR ()\fP
@@ -50,7 +53,7 @@ literals or key references. The following are examples of key references with ar
\-\- Returns a pointer to its first argument, not evaluating it.
\fBeval()\fP
-\-\- Evaluates its first argument, passing the the rest of its arguments as arg0, arg1... etc. Essentially undoes ref().
+\-\- Evaluates its first argument, passing the the rest of its arguments as argFALSE, argTRUE... etc. Essentially undoes ref().
\fBstore()\fP
\-\- Stores the evaluation of its first argument under the name specified by the (string) evaluation of its second argument. Use with ref() to store functions, or without to store variables.
@@ -59,13 +62,25 @@ literals or key references. The following are examples of key references with ar
\-\- Stores the evaluation of its first argument under the name specified by the (string) evaluation of its second argument, in the same manner as store(). Update() differs from store when the key is not found in the local scope. In this case, update() searches upwards for the first scope containing the key, and overwrites its value.
\fBeq()\fP
-\-\- Evaluates all of its arguments. If they are all equivalent, returns 1. Otherwise, returns 0. Can accept ints, floats, or strings. Strings cannot be mixed with floats or ints.
+\-\- Evaluates all of its arguments. If they are all equivalent, returns TRUE. Otherwise, returns FALSE. Can accept ints, floats, or strings. Strings cannot be mixed with floats or ints.
+
+\fBany()\fP
+\-\- Evaluates all of its arguments. If any are not FALSE, returns TRUE. Otherwise, returns FALSE. Equivalent to the logical operator OR. Short-circuits.
+
+\fBall()\fP
+\-\- Evaluates all of its arguments. If all are not FALSE, returns TRUE. Otherwise, returns FALSE. Equivalent to the logical operator AND. Short-circuits.
+
+\fBone()\fP
+\-\- Evaluates all of its arguments. If exactly one argument is not FALSE, returns TRUE. Otherwise, returns FALSE. Equivalent to the logical operator XOR. Short-circuits.
+
+\fBnone()\fP
+\-\- Evaluates all of its arguments. If none are TRUE, returns TRUE. Otherwise, returns FALSE. Short-circuits.
\fBif()\fP
-\-\- If its first argument is not 0, evaluates the rest of its arguments. Does not return a value.
+\-\- If its first argument is TRUE, evaluates the rest of its arguments.
-\fBnot()\fP
-\-\- If its first argument is 0, returns 1. Otherwise, returns 0.
+\fBwhile()\fP
+\-\- If its first argument is TRUE, evaluates the rest of its arguments. Then, if its first argument is still TRUE, evaluates the rest of its arguments again. Repeats until its first argument is FALSE.
\fBsum()\fP
\-\- Evaluates all its arguments and returns the sum. If any argument is a float, returns a float. Otherwise, returns an int.