Re: make i:j equivalent to [(k,k=i,j)]?



beliavsky@xxxxxxx wrote:
Would it break anything in Fortran to make an expression

i:j

equivalent to the array constructor

[(k,k=i,j)]

The R programming language, which has a matrix language similar to
Fortran, effectively does this. I know that "not breaking" is not by
itself sufficient reason to add "syntactic sugar" to the language.

There is at least the confusion between vector subscripts and
array sections.

In R, array subscripting is elemental, such that an array of
subscripts can be used to select the appropriate elements from
an array.

Fortran allows for vector subscripts where a rank one array
is used to supply the appropriate number of subscripts.

It might be that other places it could be used unambiguously.

-- glen
.



Relevant Pages

  • Re: Using unused variables
    ... I would prefer square brackets too, ... array constructors as replacements for the digraphs of. ... There are not enough symbols but one can wish that subscripts had ... I've heard other people argue that Fortran ...
    (comp.lang.fortran)
  • Re: make i:j equivalent to [(k,k=i,j)]?
    ... itself sufficient reason to add "syntactic sugar" to the language. ... and it will assign to A an array containing the integers 1 through N, ... That is what you can't do in Fortran with vector subscripts. ...
    (comp.lang.fortran)
  • Re: overload array index operator
    ... > Is there any way to overload the index operator in fortran? ... > a N-d array with a single subscript? ... Fortran of an index operator. ... There are restrictions on the use of vector subscripts on the ...
    (comp.lang.fortran)
  • Re: Kind of NOT integer constant
    ... The Fortran 66 rules regarding DO loops and array subscripts ... not due to the number of index registers on the 704. ...
    (comp.lang.fortran)
  • Re: maxloc question
    ... As far as I can tell, Fortran, at least as of 2003, has vector subscripts but not array subscripts. ... A subscript for a rank K array can be a single vector of length ...
    (comp.lang.fortran)