That fixes it for me. Thanks, both of you!

On Thu, Apr 12, 2012 at 12:27 AM, Sam Tobin-Hochstadt <sa...@ccs.neu.edu>wrote:

> On Wed, Apr 11, 2012 at 3:36 PM, Timothy Nelson <tbnel...@gmail.com>
> wrote:
> >
> > I'd like to write a function that consumes an s-expression and produces a
> > struct -- something similar to building a tree struct out of a tree
> sexp. In
> > the past, I've always used match for this kind of sexp manipulation.
> > However, if I have a match clause within a function like this:
> >
> > (: my-func (Sexp -> mystruct))
> > (define (my-func s)
> >   (match s
> >     [(list args ...) (make-mystruct (map my-func args))]))
>
> The problem here is that Typed Racket can't guess what type you mean
> for `args' to have, so you have to tell it when you bind `args'.  That
> looks like this:
>
> (: my-func (Sexp -> mystruct))
> (define (my-func s)
>  (match s
>     [(list #{args : (Listof Sexp)} ...)
>      (make-mystruct (map my-func args))]))
>
> which typechecks correctly for me.
> --
> sam th
> sa...@ccs.neu.edu
>
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to