godot icon indicating copy to clipboard operation
godot copied to clipboard

Add callable support for `find`, `rfind`, and `count` `Array` methods

Open SlashScreen opened this issue 1 year ago • 18 comments

I have implemented a number of methods for using callables with:

  • find (find_custom)
  • rfind (rfind_custom)
  • count (count_cusom)

I implemented these in a previous PR, but I accidentally deleted it when cleaning up my github, so I am doing it again. Also, I am better at contributing to codebases now, and working with C++.

On the last PR, count_custom could just be reduce, and indeed that's what it uses internally, but I would argue that this is okay, as there is precedent for using simple wrapper methods to avoid confusion with less experienced programmers and work with their intuition (has relies on find, append is an alias for push_back). On the other hand, instead of max_custom and min _custom, you're instructed to use reduce instead, so there is precedence against, too.

SlashScreen avatar Aug 12 '24 21:08 SlashScreen