Adding split/split' to Data.List, and redefining words/lines
with it; also, adding replace/replaceBy
Jonathan Cast
jonathanccast at fastmail.fm
Thu Jul 10 23:09:09 EDT 2008
On Thu, 2008-07-10 at 22:59 -0400, Brandon S. Allbery KF8NH wrote:
> On 2008 Jul 10, at 22:49, Jonathan Cast wrote:
>
> > On Thu, 2008-07-10 at 19:40 -0700, Eric Torreborre wrote:
> >> Hi,
> >>
> >> Neil's version of split is has the same kind of behavior than Java's,
> >> Ruby's, Python's
> >
> > Add perl to that list, as well.
>
>
> Perl's is configurable: if the regexp includes a capture, the
> captured part of each separator will be included in the returned
> list. Thus split(/(,)/, @foo) will capture the commas between the
> list items.
I got caught out in a detail of perl's semantics. This is extremely
embarrassing.
In my defense, I can only (weakly) point out that both versions proposed thus far have type String -> String -> [String] (or a generalization thereof) and that perl's behavior when passed a regular string (i.e., a return value of quotemeta) does match Neil's.
jcc
More information about the Libraries
mailing list