You can use an `and' pattern:
(: do-it (Thing -> String))
(define (do-it thing)
(match thing
((and p [Person fn ln])
(displayln fn)
(person-name p
Vincent
At Tue, 4 Dec 2012 17:53:57 -0500,
Ray Racine wrote:
>
> [1 ]
> [1.1 ]
> How does one bind an
On 2012-12-04 17:53:57 -0500, Ray Racine wrote:
>How does one bind an identifier to the matched structure?
You can use an `and` pattern. In your example:
(define js (Person "Joe" "Smith"))
(: do-it (Thing -> String))
(define (do-it thing)
(match thing
;; shadow `thing` here
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-appen
3 matches
Mail list logo