From: anamma06@... Date: 2018-05-24T00:08:06+00:00 Subject: [ruby-core:87247] [Ruby trunk Feature#14097] Add union and difference to Array Issue #14097 has been updated by ana06 (Ana Maria Martinez Gomez). and this is not necessarily related to Feature #14105. I would say that they are two different topics even if both of them aim for readability. In the case of set is only an alias and there is not a similar case as it happens here with `concat` ---------------------------------------- Feature #14097: Add union and difference to Array https://bugs.ruby-lang.org/issues/14097#change-72236 * Author: ana06 (Ana Maria Martinez Gomez) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Currently there is a concat method in ruby which does the same as +, but modifying the object. We could introduce a union and difference methods, which would be the equivalent for the `|` and `-` operators. This operators are normally less used due to lack of readability and expressivity. You end seeing thinks like: ``` array.concat(array2).uniq! ``` just because it is more readable. When it could be written like: ``` array |= array2 ``` But, as this is not clear for some people, the new method will solve this problem: ``` array.union(array2) ``` And now this is clean and readable, as everybody expect from Ruby, the language focused on simplicity and productivity. ;) Can I send a PR? :) -- https://bugs.ruby-lang.org/ Unsubscribe: