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: John Cowan
Subject: Re: [Chicken-hackers] [PATH] fix for srfi-13 string-trim-right start parameter
Date: Mon, 13 Jan 2014 02:03:22 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

Alex Shinn scripsit:

> FWIW Mario's interpretation would also require the start argument
> to be used, but in a different way - the trimming would have to be
> restricted to characters after the start:
> 
>   (string-trim-right "abc    " char-whitespace? 4) => "abc "

I don't understand that.  Substringing "abc    " to start with
4 produces "     ", which when right-trimmmed becomes "".

> Presumably for the trim to be a trim and not a splice of some sort,
> it would always truncate past end:
> 
>   (string-trim-right "abc    def" char-whitespace? 4 6) => "abc "

Again, I don't understand.  (substring "abc    def" 4 6) => "  ",
which again right-trims to "".

> The only thing to conclude is that the ref impl is buggy, and the spec
> ambiguous, but it does not directly follow which fix is correct.

The ref impl is indeed buggy (but the proposed fix changes that), but
where's the ambiguity?  I can't read the SRFI as meaning anything but
that the start/end arguments indicate the portion of the original string
to operate on; that is, it is as if substring/shared was invoked first.

-- 
We call nothing profound                        address@hidden
that is not wittily expressed.                  John Cowan
        --Northrop Frye (improved)



reply via email to

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