|
From: | Alex Shinn |
Subject: | Re: [Chicken-hackers] substring function and bounds checks |
Date: | Fri, 8 Feb 2013 07:59:43 +0900 |
On Thu, Feb 7, 2013 at 12:20 AM, Alex Shinn <address@hidden> wrote:Well, no. If I wanted a truncate function I would have asked for it. I
> Hi,
>
> On Thu, Feb 7, 2013 at 3:20 AM, Michele La Monaca
> <address@hidden> wrote:
>>
>> [..] I don't think
>>
>> (substring2 "foo" 0 10) -> "foo"
>>
>> is conceptually wrong or sloppy as long as you know exactly what the
>> semantic of the function is ("give me at most N chars" -> perl or
>> "give me chars up to the Nth position or up to the end of the string
>> whatever the first" -> python, ruby).
>
>
> Truncating a string to a maximum length is a common
> operation for formatting - I was surprised there was no
> easy way to do this with SRFI-13. But in this case the
> start argument isn't needed and distracting. You probably
> want something like:
used 0 as START to simplify the exposition (in that case the END
parameter can be interpreted as length or position indifferently).
[Prev in Thread] | Current Thread | [Next in Thread] |