Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; At times I need a condition that that is opposite. That gives me two options,
- ;; * come up with negation test that may not read clearly
- ;; * wrap the test in a (not test) form
- ;; * do the test, but swap the /then/ and /else/ parts.
- ;;
- ;; Since I'm a lazy programmer, the first two options don't appeal to me. The third option seems ugly to me. This macro takes the second option, but makes it invisible to the programmer.
- (defmacro if-not (cond then &rest else)
- "Reverses the meaning of the conditional. Saves some typing and lets the code
- read better."
- `(if (not ,cond)
- ,then
- ,@else))
Advertisement
Add Comment
Please, Sign In to add comment