Dear All,<div><br></div><div>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.</div>
<div><br></div><div>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:</div>
<div><br></div><div>(: my-func (Sexp -> mystruct))</div><div>(define (my-func s)</div><div> (match s</div><div> [(list args ...) (make-mystruct (map my-func args))]))</div><div><br></div><div>the type of args is (Listof Any), not (Listof Sexp), and thus my-func cannot be applied to it. </div>
<div><br></div><div>But if I have a clause like this:</div><div>[(list a) (make-mystruct (my-func a))]</div><div>the type of a is Sexp.</div><div><br></div><div>Am I misusing the Sexp type somehow?
</div><div><br></div><div><br></div><div>Thanks for your time,</div><div>- Tim</div>