[racket-dev] Adding flvector to match

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Thu Apr 17 19:00:36 EDT 2014

I think you should do 2': Change racket/match to recognize patterns
with #'flvector heads -- ie, use the binding for flvector from
`racket/flonum` to determine if something matches.

The use of symbolic names in match, rather than bindings, is a
leftover rather than something we should keep adding to.


On Thu, Apr 17, 2014 at 6:48 PM, Neil Toronto <neil.toronto at gmail.com> wrote:
> It would be really handy for me right now to be able to match on flvectors,
> and I think it's useful enough for minimal Racket. I've already tried this
> option:
>  1. Export flvector as a match expander from racket/flonum
> but racket/match depends on racket/flonum somehow. So I looked through the
> match code and determined that this one would be pretty easy:
>  2. Change racket/match to recognize patterns with 'flvector head
> (The code is very clean; kudos to whoever last rewrote it. :D)
> I think #2 would at worst hijack someone's custom flvector match expander,
> but probably do the same thing or better (e.g. also handle ellipses). But in
> case it's worse than I think, I can always go with this:
>  3. Export flvector as a match expander from math/flonum
> Question for the match and syntax gurus: would doing #2 be safe enough, or
> should I do #3? Or have I got it backwards; i.e. is #2 actually safer than
> #3?
> Neil ⊥
> _________________________
>  Racket Developers list:
>  http://lists.racket-lang.org/dev

Posted on the dev mailing list.