Hi,<br><br>I'm trying to get a working understanding of macros (I don't<br>know if I'll every really understand them -- I'm trying).<br><br>I understand that DATUM->SYNTAX gets it's context<br>information from it's first argument. I have no problems<br>
when using simple (non-ellipses) pattern variables, however,<br>I haven't been unable to get a strictly "ellipses pattern"<br>to work in this context (no pun intended). As a<br>work-a-round I came up w/ passing in a dummy symbol to use<br>
as the first argument but would like to find out how to do<br>it the correct way.<br><br>First my work-a-round : (works)<br><br> (define-syntax test-this<br> (lambda (x) <br> (syntax-case x ()<br> [(_ ctx a ...) <br>
(with-syntax<br> ([form (datum->syntax (syntax ctx)<br> `(+ ,@(syntax->datum (syntax (a ...)))))])<br> (syntax form))])))<br> <br> (let*-values<br>
([(one two three) (values 10 20 30)])<br> (test-this '* one two three))<br><br>I've tried this but it does not work :<br><br> (define-syntax test-this<br> (lambda (x) <br> (syntax-case x ()<br>
[(_ a ...) <br> (with-syntax<br> ([form (datum->syntax (syntax (a ...))<br> `(+ ,@(syntax->datum (syntax (a ...)))))])<br> (syntax form))])))<br>
<br> (let*-values<br> ([(one two three) (values 10 20 30)])<br> (test-this one two three))<br> <br> <br>as it comes back with the error message :<br><br> compile: unbound identifier in module in: one<br>
<br>Any help would be much appreciated.<br><br><br>