[ruby-core:95803] [Ruby master Feature#16146] Array .difference allow custom comparison
From:
jonathan@...
Date:
2019-11-11 20:34:22 UTC
List:
ruby-core #95803
Issue #16146 has been updated by jonathanhefner (Jonathan Hefner). duerst (Martin D=FCrst) wrote: > In my sentence above, 'that' refers to 'an O(n) implementation'. Naive im= plementations don't have that problem, but they are slow (O(n=B2)). But the implementation I posted is O(n). (Note that `rejected` is a Set ra= ther than an Array, so `rejected.include?` should be O(1)). ---------------------------------------- Feature #16146: Array .difference allow custom comparison https://bugs.ruby-lang.org/issues/16146#change-82624 * Author: ngomez (Nancy Gomez) * Status: Open * Priority: Normal * Assignee: = * Target version: = ---------------------------------------- Hello! I wanted to know if there's any plan to implement the ability to define com= parison between individual items in arrays. Here is where I originally asked the question on Stack Overflow: https://st= ackoverflow.com/questions/57316775/is-there-any-way-to-specify-how-to-compa= re-of-array-of-objects-for-difference-f But specifically, I noticed nearly all the existing Array functions allow u= s to define ways for comparison, such as #uniq but #difference does not :( = This is quite unfortunate but I'm hoping it's just because this function wa= s introduced in 2.6.0, and hopefully this feature can be implemented? Thanks for any and all info :) -- = https://bugs.ruby-lang.org/ Unsubscribe: <mailto:[email protected]?subject=3Dunsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>