guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] add regexp-split


From: Marijn
Subject: Re: [PATCH] add regexp-split
Date: Fri, 30 Dec 2011 11:14:32 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111117 Thunderbird/8.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 29-12-11 10:32, Nala Ginrut wrote:
> hi guilers! It seems like there's no "regexp-split" procedure in
> Guile. What we have is "string-split" which accepted Char only. So
> I wrote one for myself.
> 
> ------python code-----
>>>> import re re.split("([^0-9])", "123+456*/")
> [’123’, ’+’, ’456’, ’*’, ’’, ’/’, ’’] --------code end-------
> 
> The Guile version:
> 
> ----------guile code------- (regexp-split "([^0-9])"  "123+456*/") 
> ==>("123" "+" "456" "*" "" "/" "") ----------code end--------
> 
> Anyone interested in it?

Hi there,

I think we're all happy that Guile is getting this support, however I
couldn't help but notice that the above results look a bit funny and
indeed are incompatible with racket's implementation:

> (regexp-split "([^0-9])" "123+456*/")
'("123" "456" "" "")

Apparently because their version doesn't support capturing groups in
this function. I've raised the issue with them as well, but there are
some doubts that it is useful/sane to support this. Perhaps other
schemes' regexp libraries should be compared as well. Their tests
would certainly be useful and may point out other incompatibilities
that no-one is aware of (as well as improve your code(!)).

Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk79jwgACgkQp/VmCx0OL2zCrgCgrCtBGvKaejnfceWj8RaBz+lm
lfMAoIrR0qr8IFKhFG4KGBevf1LQfoZv
=2x7Y
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]