Does Julia have a generic way to find nonzero elemements of arrays?

In I suggested iterating over nonzero values as a possible efficient generic constructor for SparseMatrix I then proceed to realize that there isn’t such a function that works generically. SparseArrays has findnz, but it only seems to be defined for SparseMatrixCSC and SparseVector. Why is this? This feels like it would be a really useful method to have for generic structured arrays.


TODO: finish ArrayIteration. I just haven’t really needed it for my own work.