[racket-dev] `regexp-explode' etc + poll

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Mar 13 11:15:41 EDT 2012

(I should have mentioned that it's not exactly the same...)


A few minutes ago, Matthew Flatt wrote:
> I'm sorry that I missed this before, but I have a couple of minor
> suggestions:
> 
> At Tue, 13 Mar 2012 10:57:51 -0400, Eli Barzilay wrote:
> > On January 1st, Eli Barzilay wrote:
> > > 
> > >   * #:select-match
> > > 
> > >     If this is #t (the default) then the result includes the
> > >     lists of results from the sub-matches.  It can also be #f to
> > >     not include them, and it can be a "selector function" that
> > >     chooses a specific one (eg, `car' etc) or return a different
> > >     list of matches (eg, `cdr').
> 
> I think it doesn't work well to have #f vs. #t vs. something
> else. How about #f vs. 'all vs. something else?

This option is now called `#:match-select', it is either a function or
#f to drop the matches completely.  If it's #f, then `#:gap-select'
must be #t, making it equivalent to `regexp-split'.  This means that I
can drop the #f option, and to get just the gaps you'll have to use
`regexp-split'.

I mentioned earlier that I slightly like the idea of having it be #f
to make all of the possible selection methods accessible from
`regexp-match*', but that's not a strong opinion, so if you think that
it's best to leave it as a function only, I'm fine with doing that
change.


> > >   * #:select-gap
> > > 
> > >     This is just a boolean flag -- if it's #t (the default), the
> > >     strings between the matches are returned as well --
> > >     interleaved with the (lists of) matches, otherwise they're
> > >     omitted.
> 
> Should this be `#:select-gap?'?
> 
> Or maybe it's better again to replace #t with a symbol, leaving the
> name without a "?" in anticipation of additional future options.

(It's now `#:gap-select'.)

I initially had it as `#:gap-select?', and then dropped the `?' again
to make it symmetric with `#:match-select'.  I'm fine with either
re-adding it, or using a symbol as the value, if you have any
preferences for either of them.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.