`takeSorted` ignores comparator
See original GitHub issueIt seems to me that the takeSorted
function does not use the comparator function at all:
console.log([...takeSorted((a, b) => b - a, [1, 3, 2])]);
console.log([...takeSorted((a, b) => a - b, [1, 3, 2])]);
console.log([...takeSorted(3, (a, b) => b - a, [1, 3, 2])]);
console.log([...takeSorted(3, (a, b) => a - b, [1, 3, 2])]);
console.log([...takeSorted<number>(3, (a, b) => b - a)([1, 3, 2])]);
console.log([...takeSorted<number>(3, (a, b) => a - b)([1, 3, 2])]);
These all print [ 1, 2, 3 ]
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
How lambda function in takeOrdered function works in pySpark?
takeOrdered actually accepts a comparator as it's second parameter. ... Now, ignore the second element (the key) from each pair: [5, 3, 2,...
Read more >RDD Programming Guide - Spark 3.3.1 Documentation
takeOrdered (n, [ordering]), Return the first n elements of the RDD using either their natural order or a custom comparator.
Read more >CS 6240: Parallel Data Processing in MapReduce
based on S, ignoring the value of C. • While the custom Partitioner guarantees that all records for species S will be processed...
Read more >mis | Wisconsin Elections Commission
Voters can view exactly who will be on their ballot on the Type B notice published by the clerks on the Friday before...
Read more >BCMA-ES II: revisiting Bayesian CMA-ES - arXiv
ABSTRACT. This paper revisits the Bayesian CMA-ES and provides updates for normal Wishart. It emphasizes the difference between a normal.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ooh OK I take it all back. I guess my test coverage still isn’t quite what it could be. Looks like an issue in
validateArgs
left over from rework I did on my currying helpers.Don’t worry about it, I can always appreciate some progress updates! I’m glad you fixed it 😃 (sorry for the late reply) Btw, this lib will be even nicer when we get the pipeline operator. Although you may also get a ‘rival’.