How does one bind an identifier to the matched structure? In SML, Scala one can do something along the lines of s@S (x y z)
#lang typed/racket (struct: Thing ()) (struct: Person Thing ([fname : String] [lname : String])) (: person-name (Person -> String)) (define (person-name p) (string-append (Person-lname p) ", " (Person-fname p))) (define js (Person "Joe" "Smith")) (: do-it (Thing -> String)) (define (do-it thing) (match thing ([Person fn ln] (displayln fn) (person-name thing)))) This fails as `thing' is not recognized as a Person. I guess I'm wondering if there is something along the lines of the following in `match'. (match thing (p@[Person fn ln] (person-name p)))) ;; p is typed as a Person
____________________ Racket Users list: http://lists.racket-lang.org/users