The 'oddp' predicate function checks to see if the number 'expr' is odd. T is returned if the number is odd, NIL is returned otherwise.
An error is generated if the 'expr' is not a numeric expression:
error: bad argument type
An error is generated if the 'expr' is a floating point number:
error: bad floating point operation
Zero is an even number.
(oddp 0) ; returns NIL (oddp 1) ; returns T (oddp 2) ; returns NIL (oddp -1) ; returns T (oddp -2) ; returns NIL (oddp 13.0) ; error: bad floating point operation (oddp 'a) ; error: bad argument type (setq a 3) ; set value of A to 3 (oddp a) ; returns T
See the
oddp
predicate function in the