On Tue, Oct 16, 2012 at 7:55 PM, Stephen Bloch <bl...@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
sa...@ccs.neu.edu
_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev

Reply via email to