Jussi Piitulainen
10/6/2015 2:31:00 PM
CAI GENGYANG writes:
> Got it ...
>
> (if (> x y) x y)))
>
> if = IF operator that takes at least 2 statements
> (> x y) = condition
> x y = arguments
>
> One must always obey the rules set by the Gods who created Lisp
In Lisp, of all languages, you *can* set things up so that (if (> x y))
does what you seem to want it to do. You could even set your if up to do
double duty so that one-armed and two-armed ifs work as everyone expects
while unarmed ifs have your private meaning. Write a macro, probably do
some package magic.
That is, you can have (if (> x y)) be the maximum and (if (< x y)) be
the minimum of x and y, and whatever other cases you might come up with.
Do you also want (let ((z (max x y))) (if z)) be the maximum of x and y?
That's quite a bit more weird.