[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start par
From: |
Mario Domenech Goulart |
Subject: |
Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter |
Date: |
Sun, 19 Jan 2014 22:03:52 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
On Sat, 11 Jan 2014 14:04:07 -0500 John Cowan <address@hidden> wrote:
> Mario Domenech Goulart scripsit:
>
>> However, both Scheme48 and Racket return "" for
>>
>> (string-trim-right "abc " char-whitespace? 4 4)
>>
>> CHICKEN returns "abc", which looks like a bug to me.
>
> It certainly is, since the value of (substring s k k) is always "" for
> any legal k. And indeed the proposed patch, which passes start rather
> than 0 to substring, will actually make this bug worse. The correct
> value to pass is (min start (+ i 1)), which guarantees that start is
> always safe.
Quoting Taylor Campbell (from #scheme):
So, just to be clear: the right fix is to replace `0' by `start'
in the definition of STRING-TRIM-RIGHT. (Taking the minimum of
the start and (+ 1 i) is also correct but unnecessary, because
STRING-SKIP-RIGHT guarantees (<= start i).)
Best wishes.
Mario
--
http://parenteses.org/mario
- Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter, (continued)
Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter, .alyn.post., 2014/01/11
Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter, Mario Domenech Goulart, 2014/01/11
Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter,
Mario Domenech Goulart <=
Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter, John Cowan, 2014/01/22
Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter, Alex Shinn, 2014/01/22
[Chicken-hackers] Bug in SRFI 13 string-skip-right (was: fix for string-trim-right), John Cowan, 2014/01/22
Re: [Chicken-hackers] Bug in SRFI 13 string-skip-right (was: fix for string-trim-right), Alex Shinn, 2014/01/23
Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter, Mario Domenech Goulart, 2014/01/19