Re: Macro Help: 1 macro => many sexp



On May 30, 12:02 am, Edward Dodge <nos...@xxxxxxxxxxx> wrote:
[...]
As a Lisp newbie, I'm used to dealing with aggregate items as strings
or as lists, but enclosingfunction will obviously not like it if I
pass it this:

(enclosingfuncion '((expandedmacro1) (expandedmacro2)...

Assuming I have built the list of macro expansions, how do I tell Lisp
to remove the outer '() and splice the results into enclosingfunction?

I don't know how to tell Lisp how to do exactly that. However, I do
know how to tell Lisp how to do something very similar, which is to
have enclosingfunction treat the list '((expandedmacro1) ... ) as if
it were its list of parameters. You do this using the APPLY function:

(apply #'enclosingfunction '((expandedmacro1) ...))

is equivalent to

(enclosingfunction (expandedmacro1) ...)

and should do exactly what you want.

Cheers,
Pillsy


.



Relevant Pages

  • Re: Cons cell archaic!?
    ... How would the implementation of a Lisp without a using cons look like? ... the irregularity in its often cited regular syntax. ... Lisp at core is based on functional programing on lists. ...
    (comp.lang.lisp)
  • Re: How powerful macros are?
    ... >> for software engineers to use arrays for everything, ... Did I miss something or is #an impossibly unbearable syntax in Lisp? ... and arrays are often slower for very short lists. ... I've also extended the language so that I have re-readable hash tables ...
    (comp.lang.lisp)
  • Re: Cons cell archaic!?
    ... why lisp has the cons problem and was never ... langs that deal with lists, vast majority of list usage is just simple ... and if it's not done in those other languages it must be ... Java and Lisp as languages worth consiering, ...
    (comp.lang.lisp)
  • Re: Lisp collections
    ... If a programming language specification talks about a data type, ... For example, The Common Lisp Hyperspec talks about lists, ... misapprehension that Lisp programmers generally just used lists to store ...
    (comp.lang.lisp)
  • Static or runtime type-checking (was: Program compression)
    ... I know that everything and the kitchen sink has been added to LISP. ... Seed7 seems to be rather limited in what it can easily support. ... list-processing primitives as applied to linked lists (push new ... Only internal types can be checked at compile time. ...
    (comp.programming)