Project

General

Profile

Feature #10068

[PATCH] Implement monadic operator for Vector

Added by gogotanaka (Kazuki Tanaka) almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
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

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

Updated by gogotanaka (Kazuki Tanaka) almost 6 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) almost 6 years ago

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

Matz.

Updated by matz (Yukihiro Matsumoto) almost 6 years ago

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

Updated by hsbt (Hiroshi SHIBATA) almost 6 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) over 5 years ago

  • Status changed from Assigned to Closed

Done.

Thanks for catching this omission, and for the patch.

Also available in: Atom PDF