Project

General

Profile

Actions

Feature #10068

closed

[PATCH] Implement monadic operator for Vector

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

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

Description

Before

v = Vector[1, 2, 3]

 + v
=> NoMethodError: undefined method `+@' for Vector[1, 2, 3]:Vector

 - v
=> NoMethodError: undefined method `-@' for Vector[1, 2, 3]:Vector

After

v = Vector[1, 2, 3]

 + v
=> Vector[1, 2, 3]

 - v
=> Vector[-1, -2, -3]

Files

implement_uplus_for_vector.patch (842 Bytes) implement_uplus_for_vector.patch gogotanaka (Kazuki Tanaka), 07/19/2014 01:56 AM
implement_negate_for_vector.patch (1.25 KB) implement_negate_for_vector.patch gogotanaka (Kazuki Tanaka), 07/19/2014 01:56 AM

Related issues 1 (0 open1 closed)

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

Updated by gogotanaka (Kazuki Tanaka) over 10 years ago

I'm sorry my report looks ugly... I fix it. ↓

Before

v = Vector[1, 2, 3]
 
+ v
=> NoMethodError: undefined method `+@' for Vector[1, 2, 3]:Vector

- v
=> NoMethodError: undefined method `-@' for Vector[1, 2, 3]:Vector

After

v = Vector[1, 2, 3]

+ v
=> Vector[1, 2, 3]

- v
=> Vector[-1, -2, -3]

Updated by matz (Yukihiro Matsumoto) over 10 years ago

I am not sure the term monadic is a proper one, but I like the idea.

Matz.

Updated by matz (Yukihiro Matsumoto) over 10 years ago

  • Related to Feature #10069: [PATCH] Implement monadic operator for Matrix added

Updated by hsbt (Hiroshi SHIBATA) over 10 years ago

  • Category set to lib
  • Status changed from Open to Assigned
  • Assignee set to marcandre (Marc-Andre Lafortune)
  • Target version set to 2.2.0

Updated by marcandre (Marc-Andre Lafortune) about 10 years ago

  • Status changed from Assigned to Closed

Done.

Thanks for catching this omission, and for the patch.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0