Reputation: 1595
Why does (defun boolimplies (a b) (or (not a) b))
if called as
(boolimplies 'a 'b)
return B
?
How does it arrive at this conclusion even when I don't use any boolean value (NIL,T) but just variable names?
Upvotes: 1
Views: 617
Reputation: 14291
While only t
and nil
are booleans in Common Lisp, there are also generalized booleans. That is, all objects can be used as truth values, and only the symbol nil
is false. You are passing symbols other than nil
, which are true.
(Just to avoid any potential confusion: If you have variables a
and b
and want to use their values instead of symbols, just pass them unquoted.)
Upvotes: 5