core.matrix icon indicating copy to clipboard operation
core.matrix copied to clipboard

Feature request: reverse and rotate functions

Open maxrothman opened this issue 1 year ago • 2 comments

core.matrix has pretty good coverage of the APL primitives, but one notable exception is the reverse function (monadic ⌽ and ⊖). For 2d matrices with native Clojure sequences, one can work around the problem with (map reverse m), but it’d be nice to have non-abstraction-breaking core.matrix versions of these.

In a similar vein, there’s also no rotate functions. While you can work around this with (transpose (reflect m)), I suspect that a library implementation could achieve better performance.

maxrothman avatar Jan 04 '24 03:01 maxrothman

Makes sense. Any preference for API? Remembering of course that arbitrary subsets of dimensions might get reversed or rotated.....

mikera avatar Jan 09 '24 17:01 mikera

No particular preference! The multiple dimensions part definitely needs to be taken into account. I'd assume you don't want to make APL's mistake by splitting ⌽ and ⊖ as well.

maxrothman avatar Jan 09 '24 18:01 maxrothman