chicken-hackers
[Top][All Lists]
Advanced

[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: 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

On Thu, Jan 23, 2014 at 10:58 AM, John Cowan <address@hidden> wrote:
Mario Domenech Goulart scripsit:

> 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).)

Yes, he's right, but that exposes another bug:

(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.

Shouldn't it return ""?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]