[racket-dev] `regexp-match**'

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Sat Jun 4 18:29:12 EDT 2011

Why does regexp-match** need to take this extra argument?  Can't we
just use map like normal?

If we want users to process each match in turn, possibly to allow
early garbage collection, it sounds like an in-regexp-matches sequence
would be better.

Carl Eastlund

On Sat, Jun 4, 2011 at 5:08 PM, Eli Barzilay <eli at barzilay.org> wrote:
> So the request to get subgroups from `regexp-match*' is not new, and
> since I've seen it twice in a week I'm going to add it.  What I'm
> thinking to do is some `regexp-match**' that takes another argument
> that is the function to apply on the usual results of `regexp-match'.
> Assuming that this is the first argument, `regexp-match*' could be
> defined simply as:
>
>  (define (regexp-match* . xs)
>    (apply regexp-match** car xs))
>
> but now you can use `values' and get the complete results from each
> match, or `cdr' and get just the subgroups, etc.
>
> (I'll probably do some `regexp-match-positions**' too.)
>
> The question is how to add that argument.  Adding a keyword to a
> function that already has 57 arguments looks odd; adding a 58th
> argument is bad for obvious reason that lead to keyword args in the
> first place; adding it first is the most convenient, but seems like it
> would be an odd extensions.
>
> Opinions?
>
> --
>          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                    http://barzilay.org/                   Maze is Life!
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev
>



Posted on the dev mailing list.