One example is the magical introduction of special variables. Here's "aif", implemented in PLT Scheme:
(require (lib "defmacro.ss"))
(define-macro (aif a b c)
`(let ((it ,a))
(if it ,b ,c)))
(aif (* 10 10) (+ it 1) 'oops) ==> 101
The "aif" form makes it so you don't have to create a temporary variable name first -- the temp var is just assumed to be named "it".
If you're thinking, "whatever, I don't need that" you are wrong. :) Somehow this turns into the most wonderful little line-saver. At my last company, we used it all over the place.
If you're thinking, "whatever, I don't need that" you are wrong. :) Somehow this turns into the most wonderful little line-saver. At my last company, we used it all over the place.