From: Mark Wooding Date: Mon, 12 Aug 2019 10:14:01 +0000 (+0100) Subject: src/pset-impl.lisp: Accept `yup' and `nope' as booleans. X-Git-Url: https://git.distorted.org.uk/~mdw/sod/commitdiff_plain/eaa0e159e693ee8ac660a15cea6450402f120d5a?ds=sidebyside src/pset-impl.lisp: Accept `yup' and `nope' as booleans. I may draw the line at `yarp' and `narp'. --- diff --git a/doc/syntax.tex b/doc/syntax.tex index 30fcdfb..07b7ce7 100644 --- a/doc/syntax.tex +++ b/doc/syntax.tex @@ -462,10 +462,10 @@ above, are as follows. \item The @|boolean| output type denotes a boolean value, which may be either true or false. A value of type @|id| is considered true if it is @|true|, - @|t|, @|yes|, @|on|, or @|verily|; or false if it is @|false|, @|nil|, - @|no|, @|off|, or @|nowise|; it is erroneous to provide any other - identifier where a boolean value is wanted. A value of type @|int| is - considered true if it is nonzero, or false if it is zero. + @|t|, @|yes|, @|on|, @|yup|, or @|verily|; or false if it is @|false|, + @|nil|, @|no|, @|off|, @|nope|, or @|nowise|; it is erroneous to provide + any other identifier where a boolean value is wanted. A value of type + @|int| is considered true if it is nonzero, or false if it is zero. \item The @|symbol| output type denotes a Lisp symbol. diff --git a/src/pset-impl.lisp b/src/pset-impl.lisp index f5650cf..42049db 100644 --- a/src/pset-impl.lisp +++ b/src/pset-impl.lisp @@ -75,9 +75,9 @@ name (package-name package))))))))) (let ((truth-map (make-hash-table :test #'equalp))) - (dolist (string '("true" "t" "yes" "on" "verily")) + (dolist (string '("true" "t" "yes" "on" "yup" "verily")) (setf (gethash string truth-map) t)) - (dolist (string '("false" "nil" "no" "off" "nowise")) + (dolist (string '("false" "nil" "no" "off" "nope" "nowise")) (setf (gethash string truth-map) nil)) (defun truishp (string) "Convert STRING to a boolean."