JuliaLang/julia — pull request #1871 by stevengj (2013-01-02 15:33:34+00:00)
Title: extend linalg and array operations to work on Numbers when it makes sense

As discussed in #1829 and #1843, Julia treats `Number`s as iterable containers (supporting `for`, `ref`, `length`, etc), which makes it much easier to write polymorphic functions that can accept either `Number` or `Array` arguments. For the same reason, it makes sense to have several functions on arrays also work for `Number`s where it makes sense and the meaning is unambiguous, e.g. `nnz` and `findmin`.

Similarly, as discussed in #763, it is consistent with both mathematical principle and mathematical practice to have many of the linear-algebra functions, from `norm` to `eig`, work on `Number` arguments. (`inv` already worked.) Again, this makes it easier to write polymorphic functions that take `Vector`, `Matrix`, or `Number` arguments where it makes sense.