From: matz@... Date: 2014-07-19T11:16:40+00:00 Subject: [ruby-core:63871] [ruby-trunk - Feature #10069] [PATCH] Implement monadic operator for Matrix Issue #10069 has been updated by Yukihiro Matsumoto. As #10068, I like the idea, but unary operator has nothing related to inject though. Matz. ---------------------------------------- Feature #10069: [PATCH] Implement monadic operator for Matrix https://bugs.ruby-lang.org/issues/10069#change-47896 * Author: gogo tanaka * Status: Open * Priority: Normal * Assignee: * Category: * Target version: ---------------------------------------- Before ``` m = Matrix[[1,2,3], [4,5,6]] + m NoMethodError: undefined method `+@' for Matrix[[1, 2, 3], [4, 5, 6]]:Matrix - m NoMethodError: undefined method `-@' for Matrix[[1, 2, 3], [4, 5, 6]]:Matrix ``` After ``` m = Matrix[[1,2,3], [4,5,6]] + m => Matrix[[1, 2, 3], [4, 5, 6]] - m => Matrix[[-1, -2, -3], [-4, -5, -6]] ``` I think monadic operator for Matrix is important, when I use operator as block. like that ``` matrix_ary.inject(:+) ``` ---Files-------------------------------- implement_uplus_for_matrix.patch (762 Bytes) implement_negate_for_matrix.patch (1.21 KB) -- https://bugs.ruby-lang.org/