I am trying to use the case statement to make the code more readable. It seems to work like a series of if statements, but for some reason, the case statement always accepts a comparison with nil, even if that is not true. Can anyone clarify why this is happening?
Example:
> (case 'a
(nil nil)
(otherwise 'b))
NIL
> (case 'a
('a 'b)
(otherwise nil))
B
In the above example, the first instance returns nil, although "is clearly not zero." Trying to do the same with if statements, as you would expect:
> (if (eq 'a nil) nil 'b)
B
> (if (eq 'a 'a) 'b nil)
B
I assume there is some kind of behavior regarding the case statement, which I don't understand. Any help would be appreciated.
Edit: To clarify, I know that “a will not be evaluated. I simply mocked this example to create a situation in which the case target argument was definitely not null.
xlisp-plus, clisp install , -.
( ):
CLISP, . , xlisp . , .