Re: Syntax Parameters documentation for guile

2011-12-30 Thread Eli Barzilay
More than a week ago, Ian Price wrote: > > Eli, > I'd especially appreciate it if you could clear up any misconceptions I > may have, or may be unintentionally imparting on others. (And that I'm kind of on the list I can reply...) > * Syntax Parameters > > Syntax parameters[fn:1] are a mechanis

Re: add regexp-split: a summary and new proposal

2011-12-30 Thread Eli Barzilay
An hour ago, Daniel Hartwig wrote: > > Anyway, what do people think of this proposal which tries to address > that whole discussion: > > * [Vanilla `string-split' expanded to support the CHAR_PRED > semantics of `string-index' et al.] > > * New function `string-explode' similar to `string-spli

Re: [PATCH] add regexp-split

2011-12-30 Thread Eli Barzilay
Two hours ago, Daniel Hartwig wrote: > > I could not find any mention of this optional Emacs arg. you talk > about; have a pointer for me? It's the last optional argument of `split-string'. The last paragraph in the documentation notes that when you call this function with just a single argument

add regexp-split: a summary and new proposal

2011-12-30 Thread Daniel Hartwig
An attempt to summarize the pertinent points of the thread [1]. [1] http://lists.gnu.org/archive/html/guile-devel/2011-12/msg00241.html * Semantics, generally `regexp-split' is similar to `string-split'. However, between various implementations the semantics vary over the following two po

Re: [PATCH] add regexp-split

2011-12-30 Thread Daniel Hartwig
On 31 December 2011 11:21, Eli Barzilay wrote: >> A good point.  I'm interested to find out the reasoning behind >> Perl's decision to drop empty strings..  Seems a strange thing to do >> IMO. > > I think that there's a general tendency to make things "nice" and > dropping these things for cases w

Re: [PATCH] add regexp-split

2011-12-30 Thread Eli Barzilay
Just now, Daniel Hartwig wrote: > On 31 December 2011 10:32, Eli Barzilay wrote: > > 40 minutes ago, Daniel Hartwig wrote: > >> > >> I think Racket does the right thing by keeping *all* the empty > >> strings in place. > > > > Well, I do think that Perl (as well as other libraries & > > languages)

Re: [PATCH] add regexp-split

2011-12-30 Thread Daniel Hartwig
On 31 December 2011 10:32, Eli Barzilay wrote: > 40 minutes ago, Daniel Hartwig wrote: >> If two procedures are implemented they will be almost verbatim copies >> of each other. > > Yeah, but that's not an argument in favor or against -- since you can > switch between: > >  (define (foo x [other-b

Re: [PATCH] add regexp-split

2011-12-30 Thread Eli Barzilay
40 minutes ago, Daniel Hartwig wrote: > > How about having an optional argument to control the behaviour? The > default could be to not include the groups, thus mimicking the > output of Guile's `string-split' and `regexp-split' in other > Schemes. That can work, though I personally prefer a sep

Re: [PATCH] add regexp-split

2011-12-30 Thread Daniel Hartwig
Hello On 31 December 2011 04:11, Eli Barzilay wrote: > [I don't think that I'm subscribed to the Guile list, but feel free to > forward it there.] Copying back the list and Marijn. > 5 hours ago, Marijn wrote: >> On 30-12-11 12:52, Nala Ginrut wrote: >> > I just expressed "I think group capturi

Re: [PATCH] add regexp-split

2011-12-30 Thread Nala Ginrut
OK, I'll put this proc in my own lib since there's no regexp-lib but a regexp-core in Guile. Anyway, it's almost completed now. One may copy the final version if needed. On Sat, Dec 31, 2011 at 12:26 AM, Neil Jerram wrote: > Nala Ginrut writes: > > > Well, I see. > > So the previous discussion d

Re: bug#10410: guile: uri module confused by domain names starting with numbers, ipv6 addresses

2011-12-30 Thread Daniel Hartwig
On 30 December 2011 18:14, Daniel Hartwig wrote: > > `string->uri' requires similar changes to support the ipv6 address > literals.  I'm yet to found a very elegant way to do this though it is > easy enough to simply butcher `authority-pat'. So the issue was really with `parse-authority'. The at

Re: [PATCH] add regexp-split

2011-12-30 Thread Neil Jerram
Nala Ginrut writes: > Well, I see. > So the previous discussion didn't make this proc put into Guile? > Now that so many people interested in this topic.  I'm afraid I can't recall what happened following that thread. What feels important to me, though, is the elegance of the overall API. There

Re: [PATCH] add regexp-split

2011-12-30 Thread Nala Ginrut
Now that we have previous thread on this topic, I think it's no need to format a patch. Maybe this will solve the problem: (define* (regexp-split regex str #:optional (flags 0)) (let ((ret (fold-matches regex str (list '() 0 str) (lambda (m prev) (let* ((ll (car prev)) (start

Re: [PATCH] add regexp-split

2011-12-30 Thread Daniel Hartwig
On 30 December 2011 21:03, Neil Jerram wrote: > Nala Ginrut writes: > >> 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. > > We've had this topic before, and it only needs a search

Re: [PATCH] add regexp-split

2011-12-30 Thread Daniel Hartwig
On 30 December 2011 19:47, Nala Ginrut wrote: > Forget to load (srfi-1 iota) ,again... > > > On Fri, Dec 30, 2011 at 7:40 PM, Nala Ginrut wrote: >> >> Great! It's better now. >> Here's the brand new patch~ I notice that this does not handle the case where there are no matches: scheme@(guile-use

Re: [PATCH] add regexp-split

2011-12-30 Thread Nala Ginrut
Well, I see. So the previous discussion didn't make this proc put into Guile? Now that so many people interested in this topic. On Fri, Dec 30, 2011 at 9:03 PM, Neil Jerram wrote: > Nala Ginrut writes: > > > hi guilers! > > It seems like there's no "regexp-split" procedure in Guile. > > What we

Re: [PATCH] add regexp-split

2011-12-30 Thread Daniel Hartwig
On 30 December 2011 21:23, Marijn wrote: > Group capturing is useful, but the question is whether it is useful in > the context of regexp-split. Maybe it is, maybe it isn't. Racket seems > to be doing it differently than python, so I think that constitutes > reason to look more closely. Certainly

Re: [PATCH] add regexp-split

2011-12-30 Thread Marijn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 30-12-11 12:52, Nala Ginrut wrote: > I just expressed "I think group capturing is useful and someone > didn't think that's true". If this is not what your last mail > mean, I think it's better to ignore it. Group capturing is useful, but the quest

Re: [PATCH] add regexp-split

2011-12-30 Thread Neil Jerram
Nala Ginrut writes: > 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. We've had this topic before, and it only needs a search for "regex-split guile" to find it: http://old.nabble.co

Re: [PATCH] add regexp-split

2011-12-30 Thread Nala Ginrut
I just expressed "I think group capturing is useful and someone didn't think that's true". If this is not what your last mail mean, I think it's better to ignore it. On Fri, Dec 30, 2011 at 7:48 PM, Marijn wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 30-12-11 11:56, Nala Ginru

Re: [PATCH] add regexp-split

2011-12-30 Thread Nala Ginrut
Forget to load (srfi-1 iota) ,again... On Fri, Dec 30, 2011 at 7:40 PM, Nala Ginrut wrote: > Great! It's better now. > Here's the brand new patch~ > > > On Fri, Dec 30, 2011 at 5:42 PM, Daniel Hartwig wrote: > >> On 30 December 2011 16:46, Nala Ginrut wrote: >> > hi Daniel! Very glad to see yo

Re: [PATCH] add regexp-split

2011-12-30 Thread Marijn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 30-12-11 11:56, Nala Ginrut wrote: > Hmm, interesting! I must confess I'm not familiar with Racket, but > I think the aim of Guile contains practicality. Not sure what you're trying to imply here or to which of my points you're responding. > So I

Re: [PATCH] add regexp-split

2011-12-30 Thread Nala Ginrut
Great! It's better now. Here's the brand new patch~ On Fri, Dec 30, 2011 at 5:42 PM, Daniel Hartwig wrote: > On 30 December 2011 16:46, Nala Ginrut wrote: > > hi Daniel! Very glad to see your reply. > > 1. I also think the order: (regexp str) is strange. But it's according to > > python version

Re: [PATCH] add regexp-split

2011-12-30 Thread Nala Ginrut
Hmm, interesting! I must confess I'm not familiar with Racket, but I think the aim of Guile contains practicality. So I think regex-lib of Guile does this at least. Anyway, I believe an implementation should do its best to provide any useful mechanism for the user. Or it won't be popular anymore. W

bug#10410: guile: uri module confused by domain names starting with numbers, ipv6 addresses

2011-12-30 Thread Daniel Hartwig
Package: guile Version: 2.0.3 Tags: patch X-Debbugs-CC: guile-devel@gnu.org Hello I have noticed that the (web uri) module does not handle domain names that start with numbers: scheme@(guile-user)> (string->uri "http://123.com";) $1 = #f scheme@(guile-user)> (build-uri 'http #:host "123.com") w

Re: [PATCH] add regexp-split

2011-12-30 Thread Marijn
-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(

Re: [PATCH] add regexp-split

2011-12-30 Thread Daniel Hartwig
On 30 December 2011 16:46, Nala Ginrut wrote: > hi Daniel! Very glad to see your reply. > 1. I also think the order: (regexp str) is strange. But it's according to > python version. > And I think the 'string-match' also put regexp before str. Anyway, that's an > easy mend. `regexp string' is also

Re: [PATCH] add regexp-split

2011-12-30 Thread Nala Ginrut
Well, I realized it's a mistake. We can use fold-matches anyway. On Fri, Dec 30, 2011 at 4:46 PM, Nala Ginrut wrote: > hi Daniel! Very glad to see your reply. > 1. I also think the order: (regexp str) is strange. But it's according to > python version. > And I think the 'string-match' also put r

Re: [PATCH] add regexp-split

2011-12-30 Thread Nala Ginrut
hi Daniel! Very glad to see your reply. 1. I also think the order: (regexp str) is strange. But it's according to python version. And I think the 'string-match' also put regexp before str. Anyway, that's an easy mend. 2. I think it's a little different to implement a flag as python version. Since "