I've been starting to experiment with core.matrix, and I've been using code like ((mat 2) 1)
to pull out individual values from a 2d matrix when needed. Just switched to vectorz-clj, and that no longer works; nor does nth. Is there some idiomatic way to pull a single value? (first (drop 1 (first (drop 2 mat))))
works, but that's kind of ugly. I couldn't find an example in the wiki of pulling out a single value...
The canonical way to get a scalar in c.m is mget
, which should work across impls. So, if your matrix is mat
, and you want the element at 2 1, (mget mat 2 1)
will do it.
@eggsyntax ^^^^
@jsa-aerial thanks! Read through the API, but somehow overlooked mget
.