I’m using vectorz
for the first time in a project and notice that (speaking in midje
here for a moment)
(clojure.core.matrix/array [[1 2] [3 4 5]]) => (clojure.core.matrix/array [[1.0,2.0] , [5.0,0.0]] )
That is, a badly-formed tree is trimmed… that way.
I’m looking through the codebase now, wondering if there’s a way of detecting whether an argument to array
is well-formed or not, and if not what happens to the extra chunks.
Any clues would be appreciated. In the end, I’ll want some kind of matrixable?
predicate that will tell me whether an arbitrary nested argument is rectangular (of any dimension) or not.I found https://github.com/mikera/core.matrix/issues/306 after some digging, and was able to cobble something together to makes the tests pass using (apply same-shape? arg)
. And it sounds from the discussion in that issue as though there isn’t any actual checking done.