summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-06-17 06:59:46 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-06-17 06:59:46 -0700
commit95f05cafb8da2dc1a20a41b165c2e03c24d04099 (patch)
tree61ff68622bd17632bbf731ff9ffb73bc136756fb /txr.1
parent5b140a070a99937da7c0b1fac9c23b7a281be82f (diff)
downloadtxr-95f05cafb8da2dc1a20a41b165c2e03c24d04099.tar.gz
txr-95f05cafb8da2dc1a20a41b165c2e03c24d04099.tar.bz2
txr-95f05cafb8da2dc1a20a41b165c2e03c24d04099.zip
* eval.c (not_null): New static function.
(eval_init): Use null_f in existing registration of null and not. Add registration for not_null as "true", and for null_f as "false". * txr.1: Documented true and false.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.133
1 files changed, 30 insertions, 3 deletions
diff --git a/txr.1 b/txr.1
index 503b7771..23b55eac 100644
--- a/txr.1
+++ b/txr.1
@@ -6900,19 +6900,20 @@ A bignum integer: arbitrary precision integer that is heap-allocated.
.PP
There are additional kinds of objects, such as streams.
-.SS Functions null and not
+.SS Functions null, not, false
.TP
Syntax:
(null <value>)
(not <value>)
+ (false <value>)
.TP
Description:
-The null and not functions are synonyms. They tests whether <value> is the
-object nil. They return t if this is the case, nil otherwise.
+The null, not and false functions are synonyms. They tests whether <value> is
+the object nil. They return t if this is the case, nil otherwise.
.TP
Examples:
@@ -6920,6 +6921,7 @@ Examples:
(null '()) -> t
(null nil) -> t
(null ()) -> t
+ (false t) -> nil
(if (null x) (format t "x is nil!"))
@@ -6927,6 +6929,31 @@ Examples:
(if (not (memq 'a list))
(format t "list ~s does not contain the symbol a\en")))
+.SS Function true
+
+.TP
+Syntax:
+
+ (true <value>)
+
+.TP
+Description:
+
+The true function is the complement of the null, not and false functions.
+It return t if the <value> is any object other than nil. If <value> is
+nil, it returns nil.
+
+Note: programs should avoid explicitly testing values with true.
+For instance (if x ...) should be favored over (if (true x) ...)
+
+.TP
+Example:
+
+ ;; Compute indices where the list '(1 nil 2 nil 3) has true values:
+ ;; "Where is (1 nil 2 nil 3) true?"
+
+ [where '(1 nil 2 nil 3) true] -> (1 3)
+
.SS Functions eq, eql and equal
.TP