[racket] regexp-replace* with input-port ==> Re: multi-replace function

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Dec 7 05:44:37 EST 2010

15 minutes ago, YC wrote:
> On Tue, Dec 7, 2010 at 12:25 AM, Eli Barzilay <eli at barzilay.org> wrote:
> >
> > Actually, there's a problem -- there is already an optional
> > argument for the prefix, and if an output port is added, it should
> > be added before that for consistency but that will be
> > incompatible.
> 
> That's unfortunate.  Looking at v4.2.5 I did not see the
> input-prefix param, so that's probably added in v5.0.

Yes, it's a new feature, which made things like `regexp-split' and
`regexp-match*' more consistent.


> I did a quick proof of concept against 4.2.5 (which doesn't have the
> inconsistency of input-prefix), and it works AFAICT.  Of course it's
> better if this is implemented in the same layer as other regexp
> functions.

The thing is that making this handle everything can be ... difficult.
See the huge `regexp-loop' macro in collects/racket/private/string.rkt
for that.  In any case, I can't think of a natural way to add it, and
a new function is overall easier than a generalization of an existing
one.

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


Posted on the users mailing list.