elvish icon indicating copy to clipboard operation
elvish copied to clipboard

Add an `order &dedupe` option

Open krader1961 opened this issue 2 years ago • 3 comments

Related #1453

krader1961 avatar Jun 27 '22 04:06 krader1961

why is that an option instead of separate command?

SolitudeSF avatar Jun 27 '22 05:06 SolitudeSF

why is that an option instead of separate command?

For performance. It's more efficient to do the dedupe when ordering the values than it is to pipe them into a separate command. I'm also working on a separate command. See issue #1453.

krader1961 avatar Jun 27 '22 23:06 krader1961

@SolitudeSF, I just created P.R. #1569 that implements a dedupe command. So now we can efficiently sort lists with duplicate elimination and dedupe arbitrary inputs.

krader1961 avatar Jun 28 '22 00:06 krader1961

Sorry, but no.

Optimizing order | dedupe is indeed desirable, eventually. But it can and should be done transparently - the compiler can recognizing the pattern order | dedupe in a pipeline and use a more efficient implementation under the hood.

xiaq avatar Aug 28 '22 20:08 xiaq

Optimizing order | dedupe is indeed desirable, eventually. But it can and should be done transparently - the compiler can recognizing the pattern order | dedupe in a pipeline and use a more efficient implementation under the hood.

Yes, but I suspect I'll be dead before that happens. 😄

It's not clear to me why an obviously trivial optimization that works today, and the immediate future, isn't acceptable. Even if the optimization you envision is implemented in the distant future I don't see any reason to not implement the much simpler optimization today since it is trivial.

krader1961 avatar Aug 29 '22 04:08 krader1961