Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Collections] add new commonest stdlib function #1860

Open
drkameleon opened this issue Jan 13, 2025 · 3 comments
Open

[Collections] add new commonest stdlib function #1860

drkameleon opened this issue Jan 13, 2025 · 3 comments
Assignees
Labels
library Issues related to the standard library new feature New feature/addition open discussion Open discussion about features/ideas/suggestions

Comments

@drkameleon
Copy link
Collaborator

drkameleon commented Jan 13, 2025

See also: (@BNAndras)

The functionality is apparently related to mode in statistics, but since it's merely about finding "common" elements in a block, set or whatever, why wouldn't we simply include it in the Collections module? 🤔

@drkameleon drkameleon added library Issues related to the standard library open discussion Open discussion about features/ideas/suggestions new feature New feature/addition labels Jan 13, 2025
@drkameleon drkameleon self-assigned this Jan 13, 2025
@BNAndras
Copy link

What if it takes an optional predicate like maximum does? Then the user could define how they want to compare elements. That makes it a candidate for the Iterators module.

@drkameleon
Copy link
Collaborator Author

drkameleon commented Jan 13, 2025

What if it takes an optional predicate like maximum does? Then the user could define how they want to compare elements. That makes it a candidate for the Iterators module.

That could be too. Although given Arturo's nature and the difference in arity between the two versions, we'd have to choose one of the two (whether it's a "normal" function operating on blocks, or an "iterator" with the usual syntax), or have them both - but with different names...

@BNAndras
Copy link

I think the iterator would be more useful since taking a predicate would give it more utility when the user can customize the behavior especially with dealing with custom types. The version that would just work on blocks could be approximated by using tally and grabbing the key with the highest score so it's a weaker candidate for the standard library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
library Issues related to the standard library new feature New feature/addition open discussion Open discussion about features/ideas/suggestions
Projects
None yet
Development

No branches or pull requests

2 participants