mmm, you might have meant something like this?
Code: Select all
macro (mvb) nil)
(constant 'mvb (lambda-macro ()
(extend (list 'let (map list (args 0) (args 1))) (2 (args)))))
I.e., create a let clause with the two first arguments as variable assignments, then the rest forming the body.
It breaks violently on bad syntax input of course, especially if you quote the two first lists. The input with rather be without quotes, such as for instance:
You can verify the macro result e.g. by quoting the expression, as in
In any case, I'm not sure what you mean with
But this fails because i cannot pass a function or variable to 'letex.
The first term of a letex clause is a variable binding term like that of a let clause, and then those variables get replaced by their values in the clause body, which thereafter is evaluated. A simple illustration could be
which of course evaluates to 7.