How would I go about in doing a define-syntax-rule
that accepts a list as arguments and a list (or a quote, in case it is a single element) as body of a lambda?
i would like to do something like:
>(define a (lambdarize '(x y z) '(+ x y z)))
#<procedure>
>(a 1 2 3)
6
>(define b (lambdarize '(x) 'x))
#<procedure>
>(b 1)
1
I have played around with define-syntax-rule
and apply
, but since lambda
itself seems to be a macro and not a procedure, i have been stumped at trying to find it...
oh... And I would like a solution that does not use eval
, as it is pernicious...
UPDATE
thanks for the answer, Ryan... that pretty much did it! =) the problem with eval was that it is no good at catching the current scope... this way i can do stuff like
(let ([a 1])
(begin
(defmethod add ((x integer?) (y integer?)) (+ x y a))
(add 1 2)
)
which would fail miserably with eval... this is just an academic example, but i think it is a good test for correctness.