One more question. Thanks for your patience. :-)<div><br></div><div>I had this before:</div><div>(list args ...)<br><br>which became:</div><div>

(list #{args : (Listof Sexp)} ...)<br><br>Now suppose I want to match only a list of *symbols* instead of a list of Sexps, finishing with a symbol bound separately. In normal Racket, this would be:</div><div><br></div><div>
<div>&gt; (match &#39;(a b c) </div><div>    [(list (? symbol? args) ... (? symbol? lastarg)) </div><div>     (list args lastarg)])</div><div>&#39;((a b) c)</div></div><div><br></div><div>If I leave this as-is in typed/racket I naturally get the same error as before, but if I annotate args in the same way as in my last question:</div>
<div>(list (? symbol? #{args : (Listof Symbol)}) ... (? symbol? lastarg))</div><div><br></div><div>I get a bizarre type error: &quot;Type Checker: Expected (Listof Symbol), but got (Listof Any) in:&quot;, and then my entire (match ...).  </div>
<div><br></div><div>If I annotate the (? symbol args) instead of just args -- I wasn&#39;t sure what the right syntax was -- I get the original expected (Listof Symbol) got (Listof Any) error.</div><div><br></div><div>Am I mis-using annotations?</div>
<div><br></div><div>Thanks,</div><div>- Tim<br>
<br><div class="gmail_quote">On Thu, Apr 12, 2012 at 12:48 PM, Timothy Nelson <span dir="ltr">&lt;<a href="mailto:tbnelson@gmail.com" target="_blank">tbnelson@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


That fixes it for me. Thanks, both of you!<div><div></div><div><br><br><div class="gmail_quote">On Thu, Apr 12, 2012 at 12:27 AM, Sam Tobin-Hochstadt <span dir="ltr">&lt;<a href="mailto:samth@ccs.neu.edu" target="_blank">samth@ccs.neu.edu</a>&gt;</span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Wed, Apr 11, 2012 at 3:36 PM, Timothy Nelson &lt;<a href="mailto:tbnelson@gmail.com" target="_blank">tbnelson@gmail.com</a>&gt; wrote:<br>





&gt;<br>
&gt; I&#39;d like to write a function that consumes an s-expression and produces a<br>
&gt; struct -- something similar to building a tree struct out of a tree sexp. In<br>
&gt; the past, I&#39;ve always used match for this kind of sexp manipulation.<br>
&gt; However, if I have a match clause within a function like this:<br>
&gt;<br>
&gt; (: my-func (Sexp -&gt; mystruct))<br>
&gt; (define (my-func s)<br>
&gt;   (match s<br>
&gt;     [(list args ...) (make-mystruct (map my-func args))]))<br>
<br>
</div>The problem here is that Typed Racket can&#39;t guess what type you mean<br>
for `args&#39; to have, so you have to tell it when you bind `args&#39;.  That<br>
looks like this:<br>
<div><br>
(: my-func (Sexp -&gt; mystruct))<br>
(define (my-func s)<br>
  (match s<br>
</div>    [(list #{args : (Listof Sexp)} ...)<br>
<div>     (make-mystruct (map my-func args))]))<br>
<br>
</div>which typechecks correctly for me.<br>
<font color="#888888">--<br>
sam th<br>
<a href="mailto:samth@ccs.neu.edu" target="_blank">samth@ccs.neu.edu</a><br>
</font></blockquote></div><br>
</div></div></blockquote></div><br></div>