Skip to content

[RFC]: add array/base/count-ifs #18

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

Closed
kgryte opened this issue Feb 14, 2025 · 4 comments · Fixed by stdlib-js/stdlib#5952
Closed

[RFC]: add array/base/count-ifs #18

kgryte opened this issue Feb 14, 2025 · 4 comments · Fixed by stdlib-js/stdlib#5952
Assignees
Labels
difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. estimate: 2-4hrs Task which should take between 2 to 4 hours. Feature Task to add a new feature. ❌ No AI Not allowed to use AI.

Comments

@kgryte
Copy link
Member

kgryte commented Feb 14, 2025

This is the JavaScript equivalent of COUNTIFS: https://support.google.com/docs/answer/3256550?sjid=2342692862647625777-NC

Signature:

countIfs( x0, predicate0[, x1, predicate1[, x2, predicate2, ...]] )
  • Assume arrays have same length.
  • Increment count only when all predicates return a truthy value.
  • No need to support a thisArg.

Time estimate without AI: 4hrs
Time estimate with AI: 3hrs

@kgryte kgryte added difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. estimate: 2-4hrs Task which should take between 2 to 4 hours. Feature Task to add a new feature. labels Feb 14, 2025
@naterush naterush added ❌ No AI Not allowed to use AI. 🤖 AI Allowed to use AI. and removed ❌ No AI Not allowed to use AI. labels Feb 17, 2025
@naterush naterush added ❌ No AI Not allowed to use AI. and removed 🤖 AI Allowed to use AI. ❌ No AI Not allowed to use AI. labels Feb 26, 2025
@headlessNode
Copy link
Member

@naterush Could you please assign this issue a label? I'm planning to work on this issue during the weekend, thanks!

@naterush naterush added the ❌ No AI Not allowed to use AI. label Mar 7, 2025
@headlessNode
Copy link
Member

PR: stdlib-js/stdlib#5952
Time till opening PR: 3hrs 17mins
Loom recording: Link

@headlessNode
Copy link
Member

Notes:

  • This was fairly easy to implement once I understood the reference implementation mentioned in the Issue. Spent a little time on thinking about how to handle the accessors support.

  • With AI, I could research faster about the reference implementation combine that with Cursor Tab, I think the time may have been reduced to 2hrs 30mins or less.

@headlessNode
Copy link
Member

Post PR Review Notes:

  • This one needed a fair bit of refactoring. Apart from the documentation, typescript declarations, benchmark and tests the main function logic was also refactored for optimization reasons.

  • Additional time spent: 4 mins ( less time because review suggestions were very clear )

  • Some (untracked) time also spent by the reviewer, doing refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. estimate: 2-4hrs Task which should take between 2 to 4 hours. Feature Task to add a new feature. ❌ No AI Not allowed to use AI.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants