Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    $\begingroup$ wondering if Pick might be slightly more readable here. $\endgroup$ Commented Jan 6, 2021 at 1:24
  • $\begingroup$ @AccidentalFourierTransform It is probably just a matter of taste, but I think I prefer the Select form over something like Pick[tup1, keep /@ tup1]. $\endgroup$ Commented Jan 6, 2021 at 3:32
  • $\begingroup$ Sure, it is definitely a matter of taste. My point was that Pick together with a minor modification of keep might be ever so slightly cleaner/more readable. Or using the third argument. Or, being optimistic, perhaps there is a way to avoid having to define keep altogether. But I'm really just thinking out loud so don't take me too seriously :-) $\endgroup$ Commented Jan 6, 2021 at 12:48
  • 1
    $\begingroup$ +1. It might be worth mentioning that DeleteDuplicates with explicit predicate uses quadratic complexity algorithm based on pairwise comparisons, which explains the timing difference, as well as the existence of DeleteDuplicatesBy as a separate function. $\endgroup$ Commented Jan 7, 2021 at 2:26
  • 1
    $\begingroup$ I have added the new section How It Works. (also @LeonidShifrin) $\endgroup$ Commented Jan 8, 2021 at 12:32