[ruby-core:63902] [ruby-trunk - Feature #10069] [Assigned] [PATCH] Implement monadic operator for Matrix

From: shibata.hiroshi@...
Date: 2014-07-20 19:11:41 UTC
List: ruby-core #63902
Issue #10069 has been updated by Hiroshi SHIBATA.

Category set to lib
Status changed from Open to Assigned
Assignee set to Marc-Andre Lafortune
Target version set to current: 2.2.0

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

* Author: gogo tanaka
* Status: Assigned
* 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/

In This Thread

Prev Next