|
From: | Alex Shinn |
Subject: | Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter |
Date: | Thu, 23 Jan 2014 12:03:50 +0900 |
Mario Domenech Goulart scripsit:
Yes, he's right, but that exposes another bug:
> 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).)
(string-skip-right "abc " char-whitespace? 4 4) => 2
The correct result is #f; Riastradh confirmed that the correct semantics
throughout SRFI 13 for start-end is that they are conceptually applied
using substring/shared before anything else is done.
A quick look at the reference implementation suggests that it needs
to trap the case where start = end, and always return #f then.
[Prev in Thread] | Current Thread | [Next in Thread] |