I am stuck in exercise 4.28. the book "A gentle introduction to symbolic computing" (p. 129):
Usually we can rewrite IF as a combination of AND plus OR by following this simple scheme: Replace (IF test true-part false-part) with the equivalent expression (OR (AND test true-part) false-part). But this scheme is not executed for the expression (IF (ODDP 5) (EVENP 7) FOO). Why does this fail? Suggest a more complicated way to rewrite IF as a combination of AND and OR that don't fail.
(or (and (oddp 5) (or (evenp 7) t)) 'foo)evaluates the true part and stops, and it will evaluate the false part if the test was NIL, but it always returns T if the test is T, which does not reflect the behavior of IF. Is there a correct solution to the problem that has been studied so far in the book, or is it an answer to the exercise that it is not currently available?
I am not asking for a solution for the exercise, if there is one, just whether I need to continue looking for it.
source
share