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

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Jun 4 17:08:16 EDT 2011

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.


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

Posted on the dev mailing list.