Project

General

Profile

Actions

Bug #117

closed

SortedSet#flatten_merge and SortedSet#flatten can't actually flatten nested SortedSets

Added by NoKarma (Arthur Schreiber) over 16 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
[ruby-core:17145]

Description

=begin
set1 = SortedSet[1, 2]
set2 = SortedSet[3, 4, SortedSet[5, 6]]
set1.send(:flatten_merge, set2) # => raises a NoMethodError: undefined method `<=>' for #<SortedSet: {5, 6}>

SortedSet[1, 2, SortedSet[3, 4, SortedSet[5, 6, SortedSet[7, 8]]], 9, 10].flatten # => raises a NoMethodError: undefined method `<=>' for #SortedSet:0x5f2be8

SortedSet[1, 2, SortedSet[3, 4]].flatten # => raises an ArgumentError: comparison of Fixnum with SortedSet failed
=end

Actions #1

Updated by knu (Akinori MUSHA) over 16 years ago

=begin
SortedSet cannot be put in a SortedSet because it is not comparable (unsortable).

Do you suggest that it should emit an error on every new/add/merge?
I wonder if it's worth the cost..
=end

Actions #2

Updated by Anonymous over 16 years ago

=begin
Issue #117 has been updated by Akinori MUSHA.

SortedSet cannot be put in a SortedSet because it is not comparable (unsortable).

Do you suggest that it should emit an error on every new/add/merge?
I wonder if it's worth the cost..

Bug #117: SortedSet#flatten_merge and SortedSet#flatten can't actually flatten nested SortedSets
http://redmine.ruby-lang.org/issues/show/117

Author: Arthur Schreiber
Status: Open
Priority: Normal
Assigned to: Akinori MUSHA
Category:
Target version:

set1 = SortedSet[1, 2]
set2 = SortedSet[3, 4, SortedSet[5, 6]]
set1.send(:flatten_merge, set2) # => raises a NoMethodError: undefined method `<=>' for #<SortedSet: {5, 6}>

SortedSet[1, 2, SortedSet[3, 4, SortedSet[5, 6, SortedSet[7, 8]]], 9, 10].flatten # => raises a NoMethodError: undefined method `<=>' for #SortedSet:0x5f2be8

SortedSet[1, 2, SortedSet[3, 4]].flatten # => raises an ArgumentError: comparison of Fixnum with SortedSet failed


You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://redmine.ruby-lang.org/my/account

=end

Actions #3

Updated by NoKarma (Arthur Schreiber) over 16 years ago

=begin
I think that the best solution to this problem would be to undefine #flatten, #flatten! and #flatten_merge from SortedSet.
Their existance only confuses by suggesting that you can put Sets or SortedSets inside a SortedSet.
Also, there is no case I can think of where you could actually call flatten on a SortedSet.
=end

Actions #4

Updated by Anonymous over 16 years ago

=begin
Issue #117 has been updated by Arthur Schreiber.

I think that the best solution to this problem would be to undefine #flatten, #flatten! and #flatten_merge from SortedSet.
Their existance only confuses by suggesting that you can put Sets or SortedSets inside a Set.
Also, there is no case I can think of where you could actually call flatten on a SortedSet.

Bug #117: SortedSet#flatten_merge and SortedSet#flatten can't actually flatten nested SortedSets
http://redmine.ruby-lang.org/issues/show/117

Author: Arthur Schreiber
Status: Open
Priority: Normal
Assigned to: Akinori MUSHA
Category:
Target version:

set1 = SortedSet[1, 2]
set2 = SortedSet[3, 4, SortedSet[5, 6]]
set1.send(:flatten_merge, set2) # => raises a NoMethodError: undefined method `<=>' for #<SortedSet: {5, 6}>

SortedSet[1, 2, SortedSet[3, 4, SortedSet[5, 6, SortedSet[7, 8]]], 9, 10].flatten # => raises a NoMethodError: undefined method `<=>' for #SortedSet:0x5f2be8

SortedSet[1, 2, SortedSet[3, 4]].flatten # => raises an ArgumentError: comparison of Fixnum with SortedSet failed


You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://redmine.ruby-lang.org/my/account

=end

Actions #5

Updated by ujihisa (Tatsuhiro Ujihisa) over 15 years ago

=begin
By the commit http://redmine.ruby-lang.org/repositories/diff/ruby-18?rev=23322, I suggest this bug is automatically solved.
=end

Actions #6

Updated by knu (Akinori MUSHA) over 15 years ago

  • Status changed from Open to Closed

=begin
r23322 fixes this also.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0