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: .alyn.post.
Subject: Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter
Date: Sat, 11 Jan 2014 11:02:54 -0701

Did you review the, uh "rest" of sfri-13 to see if this pattern is
repeated elsewhere?  I'd suspect the implementor, making this
mistake, would make it in multiple places.

Good catch,

-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/



reply via email to

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