Feature #2832
closed
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r26801.
Marc-Andre, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end
- Status changed from Closed to Open
=begin
Thanks Matz.
Vector#map/collect should return Vector, no?
I'm fine with the others methods, like #drop(_while), #find(_all), #first, returning arrays though.
=end
=begin
Hi,
In message "Re: [ruby-core:28571] Feature #2832 Vector#each and Enumerable"
on Tue, 9 Mar 2010 13:29:03 +0900, Marc-Andre Lafortune redmine@ruby-lang.org writes:
|Vector#map/collect should return Vector, no?
I don't think so. It returns a collection of values given from the
block. Array is a representation of collection. Matrix#collect
now returns Matrix, but I consider it caused by misunderstanding.
matz.
=end
- Assignee changed from keiju (Keiju Ishitsuka) to marcandre (Marc-Andre Lafortune)
=begin
I'm probably crazy, and I must be the only one wishing this, but I wish that #collect was used to collect elements (and always returned an array), while #map was used to map an object by applying a functor to its element (and returned the original class when possible, like Set, Matrix, ...)
=end
=begin
I'm probably crazy, and I must be the only one wishing this, but I wish
that #collect was used to collect elements (and always returned an array),
while #map was used to map an object by applying a functor to its element
(and returned the original class when possible, like Set, Matrix, ...)
I think Vector#to_a#map is better than Vector#collect, since it's far more
explicit for that purpose
I agree with the fact methods like map should return their own kind of
Enumerable (for example sorting a Hash result in ... an Array)
=end
- Target version changed from 1.9.2 to 2.0.0
- Status changed from Open to Assigned
- Description updated (diff)
- Target version changed from 2.0.0 to 2.6
Marc-Andre, what do we have to do about this ticket?
I'm setting to next minor. Let me know if there is any task for 2.0.0.
--
Yusuke Endoh mame@tsg.ne.jp
- Status changed from Assigned to Closed
Right, let's close this.
I still think that Vector#map & select be covariant, and I'll change them if ever there's a request to second that.
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0