On Tuesday, December 1, 2015 at 9:38:46 PM UTC-5, Eric Forgy wrote:
>
> Then again, I wish Julia had a "strict" mode. In strict mode, the language 
> would be more pure mathematically, e.g. scalars have no indices, the 
> transpose of a vector is a covector, etc.
>

Not all vectors represent elements of a Hilbert space, and not all 2d 
arrays represent linear operators.  Sometimes arrays are just containers, 
for which those algebraic operations aren't sensible.  There's nothing 
"impure" mathematically about this, any more than there is something 
"impure" about a broadcasting operation like .* ... mathematics encompasses 
more than linear algebra.

The reason that scalars are iterable is that it can make it easier to write 
generic code, where the same code works if the argument is a single number 
or a container of numbers.  The question is not whether this is a valid 
operation in linear algebra, but rather whether the convenience of being 
able to treat numbers as indexable length-1 containers outweighs the 
potential for confusion.  Reasonable people can disagree about this, but 
let's please not get into metaphysical debates about purity.

Reply via email to