Skip to content

Instantly share code, notes, and snippets.

@back2dos
Created May 25, 2014 13:15
Show Gist options
  • Select an option

  • Save back2dos/7e0fd1e77c2fd69a2661 to your computer and use it in GitHub Desktop.

Select an option

Save back2dos/7e0fd1e77c2fd69a2661 to your computer and use it in GitHub Desktop.
Custom indexOf
package ;
class Helper {
static public function indexOf<A>(i:Iterable<A>, filter:A->Bool):Int {
var i = 0;
for (x in a) {
i++;
if (filter(x)) return i;
}
return -1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment