1. RE: error?

Why non-standard? Please see the following:

x[3..4] = 2 element-sequence.
x[3..3] = 1 element sequence.
x[3..2] = 0 element-sequence.
x[3..1] = -1 element-sequence = error.

----- Original Message -----
From: Kat <kat at kogeijin.com>
Subject: Re: error?


>
> On 25 Oct 2002, at 23:32, jbrown105 at speedymail.org wrote:
>
> >
> > On  0, Kat <kat at kogeijin.com> wrote:
> > >
> > > Ok, if
> > > decimalcount = 1
> > > (the debug screen says it is 1)
> > > then shouldn't this line crash?:
> > >
> > >    resultnum = resultnum[1..decimalcount-1] & "." &
> > > resultnum[decimalcount..length(resultnum)]
> > >
> > > since it is the same as:
> > > resultnum[1..0]
> > > ?
> > >
> > > Kat
> > >
> >
> > No.
> >
> > resultnum[1..0] is the empty sequence {}
>
> I can't help but consider that non-standard to Eu's way. It's one atom
long, it
> should be one atom returned. Or since Rob doesn't want to return reversed
> sequences if we do
>
> s = s[length(s)..1]
>
> then s[1..0] should crash as a reversed sequence of as a "upper index is
> less than 1" error. Reliable crashing is as important as reliable
non-crashing,
> isn't it?
>
> Kat
>
>
>
>

new topic     » topic index » view message » categorize

2. RE: error?

rforno at tutopia.com wrote:
> Why non-standard? Please see the following:
> 
> x[3..4] = 2 element-sequence.
> x[3..3] = 1 element sequence.
> x[3..2] = 0 element-sequence.
> x[3..1] = -1 element-sequence = error.
> 

Yeah, it does make sense, plus 0 element sequences (gotten this way) are 
very useful.

If you think about what the indexes actually mean, it makes perfect 
sense: the slice is taken from the point just BEFORE the first index to 
just AFTER the second index.  In x[3..2], both indexes are actually 
pointing to the same spot, therefore length = 0, whereas [3..1] and you 
have an appropriate error.

I wouldn't mind have reverse sequences, but with a different notation, 
probably by using negative indexes, i.e. x[3..-1] or something....




> ----- Original Message -----
> From: Kat <kat at kogeijin.com>
> To: EUforum <EUforum at topica.com>
> Sent: Friday, October 25, 2002 11:54 PM
> Subject: Re: error?
> 
> 
> > On 25 Oct 2002, at 23:32, jbrown105 at speedymail.org wrote:
> >
> > >
> > > On  0, Kat <kat at kogeijin.com> wrote:
> > > >
> > > > Ok, if
> > > > decimalcount = 1
> > > > (the debug screen says it is 1)
> > > > then shouldn't this line crash?:
> > > >
> > > >    resultnum = resultnum[1..decimalcount-1] & "." &
> > > > resultnum[decimalcount..length(resultnum)]
> > > >
> > > > since it is the same as:
> > > > resultnum[1..0]
> > > > ?
> > > >
> > > > Kat
> > > >
> > >
> > > No.
> > >
> > > resultnum[1..0] is the empty sequence {}
> >
> > I can't help but consider that non-standard to Eu's way. It's one atom
> long, it
> > should be one atom returned. Or since Rob doesn't want to return 
> > reversed
> > sequences if we do
> >
> > s = s[length(s)..1]
> >
> > then s[1..0] should crash as a reversed sequence of as a "upper index is
> > less than 1" error. Reliable crashing is as important as reliable
> non-crashing,
> > isn't it?
> >
> > Kat
> >
> >

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu