|
From: | Nala Ginrut |
Subject: | Re: [PATCH] add regexp-split |
Date: | Fri, 30 Dec 2011 18:56:57 +0800 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi there,
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?
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:
'("123" "456" "" "")
> (regexp-split "([^0-9])" "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-----
[Prev in Thread] | Current Thread | [Next in Thread] |