As a former APLer I agree that having ability to set zero origin for
indexing has its advantages in some cases and I would like to support Rolf's
request for this to be built into SPLUS.
Stephen Smith
> -----Original Message-----
> From: Rolf Turner [SMTP:rolf@math.unb.ca]
> Sent: Tuesday, June 29, 1999 2:55 PM
> To: s-news@wubios.wustl.edu
> Subject: [S] Zero origin.
>
>
>
> Many mathematical structures/sequences start ``naturally'' from 0
> rather than from 1, making it convenient to index vectors and array
> dimensions by sequences starting from 0.
>
> In APL (anybody else remember that language? I once saw it compared
> to a car which drives only in reverse gear and is instrumented in
> Greek) there was a simple way of selecting 0-origin rather than 1-origin
> for sequence indexing. This seems not to be possible in S(plus).
>
> Question 1: Might the designers of S(plus) consider adding, in some
> future release, a 0-origin switch, say to the options() function? I
> have in mind something like being able to say:
>
> > options(origin=0)
>
> after which
>
> > x[0:3,]
>
> would give me the first, second, third, and fourth rows of the matrix x.
>
> Later I would like to be able to restore normalcy by saying
>
> > options(origin=1)
>
> Would this be feasible/easy/difficult/impossible given S(plus)'s
> internal structure?
>
> It is pretty clear that if you invoked
>
> > options(origin=0)
>
> and then called upon a function which was written assuming 1-origin,
> then the sky would almost surely fall. As far as I'm concerned, that's
> quite alright and it's the user's responsibility to make sure that
> such invocations do not occur.
>
> Question 1a: What about R? Would such a feature be any easier
> (or harder?) to incorporate into R?
>
> Question 2: Am I absolutely correct in asserting that 0-origin is
> not currently available in S(plus)? I.e. is there any sort of
> work-around that would enable one to fake 0-origin in a moderately
> convenient way?
>
> cheers,
>
> Rolf Turner
> rolf@math.unb.ca
> -----------------------------------------------------------------------
> This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
> send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
> message: unsubscribe s-news
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|