<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body>
I'm not quite sure, but I think Matt's problem is converting syntax to
symbols or something like that.<br>
You could try using define-macro like in the file bind.scm (it won't
let me copy and paste for some reason).<br>
The file bind.scm.test contains test cases.<br>
<br>
David Van Horn wrote:<br>
<blockquote type="cite" cite="mid3ECEFB54.8010005@cs.uvm.edu">
<pre wrap=""> For list-related administrative tasks:
<a class="moz-txt-link-freetext" href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a>
<a class="moz-txt-link-abbreviated" href="mailto:mcj4@ukc.ac.uk">mcj4@ukc.ac.uk</a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hello,
I'm working on my macro-fu. In my imagination, the form
(bind ([v c1 c2 c3] [v2 c4 c5] [v3 c6]) 'thisisatest)
expands to =>
(let ((v.c1 (vector-ref v 0))
(v.c2 (vector-ref v 1))
(v.c3 (vector-ref v 2))
(v2.c4 (vector-ref v2 0))
(v2.c5 (vector-ref v2 1))
(v3.c6 (vector-ref v3 0)))
(quote thisisatest))
</pre>
</blockquote>
<pre wrap=""><!---->
This gets you pretty close. There's no v.c style binding, but it's compact
and clear.
BTW, I couldn't reproduce your #%app not bound error...
(define-syntax bind
(syntax-rules ()
((_ ([v c1 c2 ...] ...) e ...)
(let-values ([(c1 c2 ...) (vector->values v)]
...)
e ...))))
(define (vector->values v)
(apply values (vector->list v)))
(define v1 #(1 2 3))
(define v2 #(4 5))
(bind ([v1 c1 c2 c3]
[v2 c4 c5])
(+ c1 c2 c3 c4 c5)) ;; -> 15
-d
</pre>
</blockquote>
</body>
</html>