[racket-dev] [plt] Push #25466: master branch updated

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Wed Oct 17 07:41:19 EDT 2012

On Tue, Oct 16, 2012 at 7:55 PM, Stephen Bloch <bloch at adelphi.edu> wrote:
>>> Another data point: If "define/match" expands to a "define" of a procedure
>>> that dispatches to a set of implementations based on a pattern-match of
>>> actual arguments... then the name is exactly what I'd expect for such a
>>> feature in a Scheme dialect.
>> That is, in fact, exactly what it does.
> Cool!  My students have been writing code that way for years, and I've been telling them "There are languages in which that would work, but Scheme isn't one of them."
> (define (swap (make-posn x y))
>     (make-posn y x))

The syntax looks like:

  (define/match (swap p)
     [(posn x y) (posn y x)])

sam th
samth at ccs.neu.edu

Posted on the dev mailing list.