From maechler at stat.math.ethz.ch  Fri Dec 10 15:44:29 2004
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Fri Dec 10 15:44:33 2004
Subject: [Rd] Re: [R] Is  k  equivalent to  k:k ?
In-Reply-To: <n59jr0hiug8rvg6k1rmeos17bi9k66tdob@4ax.com>
References: <200412100137.iBA1bGMV054978@atlas.otago.ac.nz>
	<16825.24334.69465.599617@gargle.gargle.HOWL>
	<n59jr0hiug8rvg6k1rmeos17bi9k66tdob@4ax.com>
Message-ID: <16825.46669.181498.831132@gargle.gargle.HOWL>

>>>>> "Duncan" == Duncan Murdoch <murdoch@stats.uwo.ca>
>>>>>     on Fri, 10 Dec 2004 08:38:34 -0500 writes:

    Duncan> On Fri, 10 Dec 2004 09:32:14 +0100, Martin Maechler
    Duncan> <maechler@stat.math.ethz.ch> wrote :

    RichOK> If you want to pass seq(length=n) to a .C or
    RichOK> .Fortran call, it's not helpful that you can't tell
    RichOK> what the type is until you know n!  It would be nice
    RichOK> if seq(length=n) always returned the same type.  I
    RichOK> use seq(length=n) often instead of 1:n because I'd
    RichOK> like my code to work when n == 0; it would make life
    RichOK> simpler if seq(length=n) and 1:n were the same type.
    >> 
    >> now if that really makes your *life* simpler, what does that
    >> tell us about your life  ;-) :-)
    >> 
    >> But yes, you are right.  All should return integer I think.

    Duncan> Yes, it should be consistent, and integer makes sense here.

the R-devel version now does;  and so does  seq(along = <.>)

Also ?seq {or ?seq.default} now has the value section as

> Value:

>      The result is of 'mode' '"integer"' if 'from' is (numerically
>      equal to an) integer and, e.g., only 'to' is specified, or also if
>      only 'length' or only 'along.with' is specified.

which is correct {and I hope does not imply that it gives *all* cases of
an integer result}.

Martin


[Rd] Re: [R] Is k equivalent to k:k ?
Martin Maechler