[racket-dev] [plt] Push #25466: master branch updated
What is 'p' in this example?
On Wednesday, October 17, 2012, Sam Tobin-Hochstadt wrote:
> On Tue, Oct 16, 2012 at 7:55 PM, Stephen Bloch <bloch at adelphi.edu<javascript:;>>
> 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 <javascript:;>
> _________________________
> Racket Developers list:
> http://lists.racket-lang.org/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20121017/fdc78cfb/attachment.html>