From: peter.hillerstrom@... Date: 2015-08-08T15:31:25+00:00 Subject: [ruby-core:70272] [Ruby trunk - Bug #11422] [Open] All common set operations produce incorrect (and surprising) results on a set of sets Issue #11422 has been reported by Peter Hillerstr��m. ---------------------------------------- Bug #11422: All common set operations produce incorrect (and surprising) results on a set of sets https://bugs.ruby-lang.org/issues/11422 * Author: Peter Hillerstr��m * Status: Open * Priority: Normal * Assignee: * ruby -v: 2.2.2 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- # Set operations on a set of sets produce incorrect results It seems that almost all common set operations (subtract, superset?, subset?, difference, etc...) produce (mathematically) incorrect results on a set of sets, in that they just return the set of sets unmodified. The union, intersection, and exclusion operations produce even weirder results, even when both parameters are sets of sets ��� some members of the result are scalar values and some are sets. ```ruby 2.2.2 :119 > ab = Set.new(['A', 'B']) => # 2.2.2 :120 > c = Set.new(['C']) => # 2.2.2 :121 > abc = Set.new([ab, c]) ``` ## Substraction fails ```ruby 2.2.2 :122 > abc - c => #, #}> ``` ## Superset fails ```ruby 2.2.2 :140 > abc > ab => false ``` See [more examples](http://pastie.org/10337538#18) on pastie.org. Python just throws `TypeError: unhashable type: 'set'`. -- https://bugs.ruby-lang.org/