On 6/21/21 9:25 PM, Bill Dunlap wrote:
NULL cannot be in an integer or numeric vector so it would not be a good
fit for substring's 'first' or 'last' argument (or substr's 'start' and
'stop').
Yes, that would only work if used as a scalar, such as in the default
for 'last' where 100L is
NULL cannot be in an integer or numeric vector so it would not be a good
fit for substring's 'first' or 'last' argument (or substr's 'start' and
'stop'). Also, it is conceivable that string lengths may be 64 bit
integers in the future, so why not use Inf as the default? Then the
following would g
Thanks all, great points well taken. Indeed it seems the default of
100 predates SVN tracking in 1997.
I think a NULL default behaving as "end of string" regardless of
encoding makes sense and avoids the overheads of a $ call and a much
heavier nchar() calculation.
Mike C
On Mon, Jun 21, 202
> Tomas Kalibera
> on Mon, 21 Jun 2021 10:08:37 +0200 writes:
> On 6/21/21 9:35 AM, Martin Maechler wrote:
>>> Michael Chirico
>>> on Sun, 20 Jun 2021 15:20:26 -0700 writes:
>> > Currently, substring defaults to last=100L, which
>> > strongly suggests t
On 6/21/21 9:35 AM, Martin Maechler wrote:
Michael Chirico
on Sun, 20 Jun 2021 15:20:26 -0700 writes:
> Currently, substring defaults to last=100L, which
> strongly suggests the intent is to default to "nchar(x)"
> without having to compute/allocate that up front.
> Michael Chirico
> on Sun, 20 Jun 2021 15:20:26 -0700 writes:
> Currently, substring defaults to last=100L, which
> strongly suggests the intent is to default to "nchar(x)"
> without having to compute/allocate that up front.
> Unfortunately, this default makes no
> On Sunday, June 20, 2021, 9:29:28 PM EDT, brodie gaslam via R-devel
> wrote:
>
>> On Sunday, June 20, 2021, 6:21:22 PM EDT, Michael Chirico
>> wrote:
>>
>> The max width of a string is .Machine$integer.max-1:
>
> I think the max width is .Machine$integer.max. What happened below is a
> bug d
> On Sunday, June 20, 2021, 6:21:22 PM EDT, Michael Chirico
> wrote:
>
> Currently, substring defaults to last=100L, which strongly
> suggests the intent is to default to "nchar(x)" without having to
> compute/allocate that up front.
>
> Unfortunately, this default makes no sense for "very
Currently, substring defaults to last=100L, which strongly
suggests the intent is to default to "nchar(x)" without having to
compute/allocate that up front.
Unfortunately, this default makes no sense for "very large" strings
which may exceed 100L in "width".
The max width of a string is .