Upon compile, SBCL complains that (mod number 10)
is unreachable in
(defun foo (number)
(cond
((> number 10) (mod number 10))
(t number)))
Why is this so?
The full compiler message:
; in: DEFUN FOO
; (MOD NUMBER 10)
; --> LET IF AND IF IF PLUSP >
; ==>
; NUMBER
;
; note: deleting unreachable code
Looking at the comments, it's most likely dead code elimination of code that (mod number 10)
expanded to.
On SBCL 2.0.0 and later, I'm not able to reproduce the warning.
AKA Compiler 'bug'