Consider multiplication. @a »*« @b is explicitly element-wise looping over the operator. @a * @b is not built-in, and could be defined, for example, between two Matrix objects if you like, to do matrix multiplication. You could also define infix:<+> between two lists to simply call the hyperoperator. Also, the syntax generalizes more than the implicit way of Fortran: apply a method call to each element, rather than to the container itself. | [reply] |
Usually (F90 permits overloading), F90's array operations apply the same operation to each element of an array, and cannot process arrays which aren't conformal (same organization), so F90's array operation A = B * C would be the equivalent to
real,dimension(2,3,4) :: A, B, C
integer j, k, m
do j = 1, 2
do k = 1, 3
do m = 1, 4
A(j,k,m) = B(j,k,m) * C(j,k,m)
enddo
enddo
enddo
Of course, Fortran programmers like typing no more than any other type of programmer1, so A = B * C would be preferred ;-).
I'm not saying that the F90 way is optimal; it's just that the philosophy behind the F90 standard is to make parallelization transparent to the application programmer, which means that having a different syntax for parallel operations would be frowned upon. Certainly, some of Perl's existing syntax (grep, many list operations) could be parallelized without any visible changes to the language.
1 Well, maybe COBOL programmers like typing, but I wouldn't want to stereotype them.
Information about American English usage here and here. Floating point issues? Please read this before posting. — emc
| [reply] [d/l] |