From: ruby-core@...
Date: 2014-10-07T20:19:50+00:00
Subject: [ruby-core:65495] [ruby-trunk - Feature #10069] [Closed] [PATCH] Implement monadic operator for Matrix

Issue #10069 has been updated by Marc-Andre Lafortune.

Status changed from Assigned to Closed

Done.

Thanks for catching this omission, and for the patch.

----------------------------------------
Feature #10069: [PATCH] Implement monadic operator for Matrix
https://bugs.ruby-lang.org/issues/10069#change-49272

* Author: gogo tanaka
* Status: Closed
* Priority: Normal
* Assignee: Marc-Andre Lafortune
* Category: lib
* Target version: current: 2.2.0
----------------------------------------
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/