Bug #117 [ruby-core:17145]
SortedSet#flatten_merge and SortedSet#flatten can't actually flatten nested SortedSets
| Status : | Closed | Start : | 06/09/2008 | |
| Priority : | Normal | Due date : | ||
| Assigned to : | Akinori MUSHA | % 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
06/09/2008 06:09 PM - 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..
06/09/2008 06:09 PM - Anonymous
Issue#117has 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
06/11/2008 04:02 AM - 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 SortedSet. Also, there is no case I can think of where you could actually call flatten on a SortedSet.
06/11/2008 04:10 AM - Anonymous
Issue#117has 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
05/03/2009 02:34 AM - ujihisa .
By the commit http://redmine.ruby-lang.org/repositories/diff/ruby-18?rev=23322, I suggest this bug is automatically solved.