<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On 6 Jan 2009, at 15:55, Casey Klein wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Tue, Jan 6, 2009 at 7:33 AM, Noel Welsh <<a href="mailto:noelwelsh@gmail.com">noelwelsh@gmail.com</a>> wrote:<br><blockquote type="cite">Something that might work, depending on your macro<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> Pass the arguments to the a define-for-syntax function with<br></blockquote><blockquote type="cite">appropriate keyword arguments.</blockquote><br>using keyword-apply?<br></div></blockquote></div><div><br></div><div>Yes. That will work, but you still need to fold over the arguments to accumulate keyword/value pairs.</div><div><br></div><div>That keyword-apply* macro will do that for you. I've added it to Unlib (version 3.11):</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">#lang scheme<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">(require (for-syntax (planet untyped/unlib:3:11/keyword)))<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">(define-for-syntax keywords->alist<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"> (lambda (#:a [a 1] #:b [b 2] [c 3] [d 4]. rest)<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"> (list (cons 'a a)<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"> (cons 'b b)<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"> (cons 'c c)<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"> (cons 'd d)<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"> (cons 'rest rest))))<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">(define-syntax (test-macro stx)<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"> (syntax-case stx ()<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"> [(_ arg ...)<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"> (let ([args (map syntax->datum (syntax->list #'(arg ...)))])<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"> #`(quote #,(keyword-apply* keywords->alist args)))]))<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">; Try these:<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">; (test-macro)<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">; (test-macro 123)<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">; (test-macro 123 234 345)<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">; (test-macro #:a 123 #:b 234 345)<br></span></font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">; (test-macro #:a 123 #:b 234 #:c 345)</span></font><div><br></div></blockquote><div><div>Hope this helps,</div><div><br></div></div><div>-- Dave</div><div><br></div></body></html>