Re: Appropriate case for a macro?



Brian Adkins wrote:
However, this seems like a pragmatic hack since a new variable is
introduced simply for conciseness. Would you consider this an
appropriate case for a macro in Common Lisp?

Perhaps used as follows:

(my-if (> a-long-expression value)
(progn
(foo lhs)
(bar lhs))
(baz lhs))

where a-long-expression has been replaced by lhs
It would be a rather simple macro, but if used that same pattern all
of the time, why not?

If the macro is always going to be invoked with a PROGN with two forms
and one form, you could make it accept three. You could also make it
so you can control what variable the value of a-long-expression is
bound to.
.



Relevant Pages

  • Re: Appropriate case for a macro?
    ... One of the things that attracts me to Lisp is the macro ... This can be made more concise via an assignment: ... (bar lhs)) ...
    (comp.lang.lisp)
  • Re: Appropriate case for a macro?
    ... One of the things that attracts me to Lisp is the macro ... This can be made more concise via an assignment: ... (bar lhs)) ...
    (comp.lang.lisp)
  • Re: Appropriate case for a macro?
    ... One of the things that attracts me to Lisp is the macro ... (bar lhs)) ... where a-long-expression has been replaced by lhs ...
    (comp.lang.lisp)
  • Re: Need help on bit operations define
    ... macro causes one or more bits (defined by the mask on the RHS) to be ... set in the LHS. ... left &7 times) in the object (presumably with integer type) found ...
    (comp.lang.c)