Re: [Chicken-users] irregex-replace return value

2014-03-05 Thread Michele La Monaca
On Tue, Mar 4, 2014 at 10:19 AM, Michele La Monaca mikele.chic...@lamonaca.net wrote: After some more mulling, I concluded that it would be even more convenient to have a generalised version of irregex-replace-match which also accepts lists of matches: (irregex-replace-match

Re: [Chicken-users] irregex-replace return value

2014-03-04 Thread Michele La Monaca
On Tue, Mar 4, 2014 at 1:05 AM, Michele La Monaca mikele.chic...@lamonaca.net wrote: (define (my-own-irregex-replace irx s . o) (let ((m (irregex-search irx s))) (and m (string-append (substring s 0 (irregex-match-start-index m 0)) (apply string-append (reverse

Re: [Chicken-users] irregex-replace return value

2014-03-03 Thread Alex Shinn
On Sun, Mar 2, 2014 at 8:51 PM, Michele La Monaca mikele.chic...@lamonaca.net wrote: While writing my own version of irregex-replace can be (hopefully) an enjoyable 6-line coding experience (btw, irregex-apply-match is not documented): Oops, thanks, I'll document it. (define

Re: [Chicken-users] irregex-replace return value

2014-03-03 Thread Michele La Monaca
(define (my-own-irregex-replace irx s . o) (let ((m (irregex-search irx s))) (and m (string-append (substring s 0 (irregex-match-start-index m 0)) (apply string-append (reverse (irregex-apply-match m o))) (substring s (irregex-match-end-index m 0)

Re: [Chicken-users] irregex-replace return value

2014-03-02 Thread Alex Shinn
Hi Michele, On Sat, Mar 1, 2014 at 7:32 AM, Michele La Monaca mikele.chic...@lamonaca.net wrote: Hi, I've noticed that irregex-replace returns the original string if no replacement takes place. I think its a very poor choice. Whether or not a replacement was actually made can be an

Re: [Chicken-users] irregex-replace return value

2014-03-02 Thread Michele La Monaca
Hi Alex, I've used irregex-replace{,/all} and equivalents in other languages for a long time, and find the current semantics most convenient. I can see in some cases wanting to test for a replacement, or in irregex-replace-all the number of replacements, but it seems to be by far the rarer

[Chicken-users] irregex-replace return value

2014-02-28 Thread Michele La Monaca
Hi, I've noticed that irregex-replace returns the original string if no replacement takes place. I think its a very poor choice. Whether or not a replacement was actually made can be an important piece of information which is lost returning the original string. The correct return value should be