Feature Requests: Browse | Submit New | Admin

[#27504] include Enumerable

Date:
2009-12-01 21:38
Priority:
3
Submitted By:
Matt Someone (v01d)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
include Enumerable

Detailed description
In NVector and possibly other classes.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2009-12-02 07:51
Sender: Masahiro Tanaka

because NArray#each is much slower than Array#each.
In NArray#each method, Ruby object is created for each element
and the cost of object creation is high.
Date: 2009-12-02 07:19
Sender: Masahiro Tanaka

min_by should be replaced by NArray operation and min method.
map returns an Array object, not NArray or NVector.
If Ruby block is the unique solution, I consider the use of Array,
not NArray.
Date: 2009-12-02 01:37
Sender: Matt Someone

EDIT:
Well, I was thinking in having methods like map, min_by and 
such, which *work* by just having "each" defined (as
is the
case
for NVector and others).
Date: 2009-12-02 01:35
Sender: Matt Someone

Well, I was thinking in having methods like map, min_by and 
such, which by just having "each" defined (as is the
case
for NVector and others).

I see you already provide max and other methods. These could 
override Enumerable's to keep efficient implementations in 
these cases, and at the same time provide the rest of 
Enumerable's methods.

In other words, I propose including Enumerable before any 
method definition of your own.

Matt
Date: 2009-12-02 01:30
Sender: Masahiro Tanaka

I do not understand why Enumerable is useful.
Please use NArray method.
It's faster and efficient.

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item