Bug #117
SortedSet#flatten_merge and SortedSet#flatten can't actually flatten nested SortedSets
| Status: | Closed | Start date: | 06/09/2008 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | - | |||
| ruby -v: |
Description
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
History
Updated by knu (Akinori MUSHA) almost 4 years ago
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..
Updated by Anonymous almost 4 years ago
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
Updated by NoKarma (Arthur Schreiber) almost 4 years ago
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.
Updated by Anonymous almost 4 years ago
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
Updated by ujihisa (ujihisa .) about 3 years ago
By the commit http://redmine.ruby-lang.org/repositories/diff/ruby-18?rev=23322, I suggest this bug is automatically solved.
Updated by knu (Akinori MUSHA) about 3 years ago
- Status changed from Open to Closed
r23322 fixes this also.