question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`takeSorted` ignores comparator

See original GitHub issue

It 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:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
conartist6commented, Sep 15, 2021

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.

0reactions
stevenwdvcommented, Sep 18, 2021

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’.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found