Dear All,

I have recently been trying out typed/racket with an eye toward using it in
my regular programming. I've hit a snag, and hopefully it's a newbie
mistake that you folks can set right.

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 type of args is (Listof Any), not (Listof Sexp), and thus my-func
cannot be applied to it.

But if I have a clause like this:
[(list a) (make-mystruct (my-func a))]
the type of a is Sexp.

Am I misusing the Sexp type somehow?


Thanks for your time,
- Tim
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to