Minilisp.pm/t/bool.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

35 lines
693 B
Raku

;; Constants
(expect "True is true" (eq 1 (if t 1 0)))
(expect "False is false" (eq 1 (if nil 0 1)))
(expect "not f == t" (not nil))
(expect "not t == f" (eq 1 (if (not t) 0 1)))
;; operator and
(expect "and operator: t && t == t"
(and t t))
(expect "and operator: t && f == f"
(not (and t nil)))
(expect "and operator: f && t == f"
(not (and nil t)))
(expect "and operator: f && f == f"
(not (and nil nil)))
;; operator or
(expect "or operator: t || t == t"
(or t t))
(expect "or operator: t || f == t"
(or t nil))
(expect "or operator: f || t == t"
(or nil t))
(expect "or operator: f || f == f"
(not (or nil nil)))