[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: |
.alyn.post. |
Subject: |
Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter |
Date: |
Sat, 11 Jan 2014 11:05:08 -0700 |
The relevant sections of srfi-13, for anyone who wishes to review:
http://srfi.schemers.org/srfi-13/srfi-13.html#string-trim-right
and under Procedure Specification:
Start and end parameters are half-open string indices specifying a
substring within a string parameter; when optional, they default to
0 and the length of the string, respectively. When specified, it
must be the case that 0 <= start <= end <= (string-length s), for
the corresponding parameter s. They typically restrict a procedure's
action to the indicated substring.
-a
On Sat, Jan 11, 2014 at 09:31:04AM -0800, Seth Alves wrote:
> After some discussion in #chicken, we concluded that
>
> (string-trim-right "abc " char-whitespace? 1) --> "abc"
>
> is wrong and that the right answer is "bc". Gauche and Sagittarius and
> Guile return "bc". Racket returns "abc" but appears, like CHICKEN, to
> have faithfully ported the bug from the reference implementation.
>
> -seth
>
>
> diff --git a/srfi-13.scm b/srfi-13.scm
> index 7b16153..37e142c 100644
> --- a/srfi-13.scm
> +++ b/srfi-13.scm
> @@ -1066,7 +1066,7 @@
> (let-optionals* criteria+start+end ((criteria char-set:whitespace) rest)
> (let-string-start+end (start end) string-trim-right s rest
> (cond ((string-skip-right s criteria start end) =>
> - (lambda (i) (%substring/shared s 0 (+ 1 i))))
> + (lambda (i) (%substring/shared s start (+ 1 i))))
> (else "")))))
>
> (define (string-trim-both s . criteria+start+end)
> _______________________________________________
> Chicken-hackers mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/chicken-hackers
--
my personal website: http://c0redump.org/
Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter,
.alyn.post. <=
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, 2014/01/19
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