src/pset-impl.lisp: Improve boolean literal handling.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 27 Jul 2019 00:01:47 +0000 (01:01 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 3 Aug 2019 15:27:36 +0000 (16:27 +0100)
  * Allow `on' and `off'.

  * Recognize literals case-insensitively.

src/pset-impl.lisp

index e6986a5..f938ad3 100644 (file)
                 (error "Symbol `~A' not external in package `~A'"
                        name (package-name package)))))))))
 
-(let ((truish '("true" "t" "yes" "verily"))
-      (falsish '("false" "nil" "no" "nowise")))
+(let ((truish '("true" "t" "yes" "on" "verily"))
+      (falsish '("false" "nil" "no" "off" "nowise")))
   (defun truishp (string)
     "Convert STRING to a boolean."
-    (cond ((member string truish :test #'string=) t)
-         ((member string falsish :test #'string=) nil)
+    (cond ((member string truish :test #'string-equal) t)
+         ((member string falsish :test #'string-equal) nil)
          (t (error "Unrecognized boolean value `~A'" string)))))
 
 ;;;--------------------------------------------------------------------------