help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about Range class


From: John W. Eaton
Subject: Re: Question about Range class
Date: Thu, 24 Nov 2005 09:36:28 -0500

On 24-Nov-2005, Shai Ayal wrote:

| Robert A. Macy wrote:
| > Pedro,
| > 
| > In octave, two arguments...
| >  z = (1:100)/10
| > 
| > or, three arguments...
| >  Z = (1:0.1:10)
| > ...give identical z arrays, but the increment is STILL
| > placed between the start and finish.  Going from two
| > arguments to three, one inserts the increment between.
| 
| True, but you can't do that very easily in c++.

Why not?  True, you can't use the base:increment:limit syntax (with
the colon operator) but you could define Range constuctors that
approximate it.  The two argument Range constructor could accept base
and limit arguments and set increment to 1.  The three argument version
could accept base, increment, and limit arguments (in that order).

But it happens that I did not make that choice way back when.
As I said, I was probably influenced by Fortran's

      do 10 base, limit [, increment]
        ...
   10 continue

syntax.

In any case, there's little chance of going back now.

jwe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]