I love it when I find something simple and useful. One of the things we notice with boolean functions is that they invariably are inside an If...then... expression. Now sometimes we want the truth value of the statement but many times we are only using it to decide whether we are going to use the argument that was input or not. For instance,
In this case we do not need the truth value itself but only x. Now suppose we wrote the following function
Code: Select all
(if (eval (args))
(eval (args 1))))
Now we could write the previous as (setq z (rtn < x)). This eliminates always having to write the conditional statement. RTN can be used with booleans that take more than one argument. For instance,
(if (= x y)(setq z x)) would be (setq z (rtn = x y)). If the boolean test is true then the first argument of the multiple arguments is returned. The name RTN is an abbreviation of RETURN because the function returns the input when true.
Now we may not be setting the value to a variable but just using it directly in a calculation as in
But using RTN this becomes simply (* (rtn < x y) 4). I think you'll agree that this happens quite a lot. Hope you find it useful.