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: Mario Domenech Goulart
Subject: Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter
Date: Sat, 11 Jan 2014 18:24:26 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hi,

On Sat, 11 Jan 2014 09:31:04 -0800 Seth Alves <address@hidden> 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".

I actually expect "abc" to be the right result. I wouldn't expect it to
return a string with characters that don't match the second argument
removed.

The text from srfi-13 quoted by Alan in another message seem to
make things clearer:

  They [start and end] typically restrict a procedure's action to the
  indicated substring.

As as I understand it, (string-trim-right "abc  " char-whitespace? 1)
should trim "bc  ", not that it should trim "abc  " then substring it
from 1.

> Racket returns "abc" but appears, like CHICKEN, to have faithfully
> ported the bug from the reference implementation.

So does Scheme48.

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.

Best wishes.
Mario
-- 
http://parenteses.org/mario



reply via email to

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