Project

General

Profile

Actions

Feature #10069

closed

[PATCH] Implement monadic operator for Matrix

Added by gogotanaka (Kazuki Tanaka) over 10 years ago. Updated about 10 years ago.

Status:
Closed
Target version:
[ruby-core:63850]

Description

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_uplus_for_matrix.patch gogotanaka (Kazuki Tanaka), 07/19/2014 02:07 AM
implement_negate_for_matrix.patch (1.21 KB) implement_negate_for_matrix.patch gogotanaka (Kazuki Tanaka), 07/19/2014 02:07 AM

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #10068: [PATCH] Implement monadic operator for VectorClosedmarcandre (Marc-Andre Lafortune)07/19/2014Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0