Minilisp.pm/t/and_or.t
madmaurice 7f1283eecc Improve bool system
lisp has true in form of t and false in form of nil
2021-04-05 00:06:49 +02:00

14 lines
377 B
Raku

(let ((a 'ok))
(and nil (set a 'fail))
(expect "and - Short circuit" (equal a 'ok)))
;; (let ((a 'ok))
;; (or t (set a 'fail))
;; (expect "or - short circuit" (equal a 'ok)))
(expect "and - returns last value if all operands evaluate to true"
(equal (and t 'ok) 'ok))
(expect "and - returns nil if any operand evaluates to false"
(null (and nil t)))