I guess the concept of finding the ‘first’ element that matches something in a set, doesn’t make sense, since sets are not ordered. It would be more akin to random sampling.
I was hoping that there already exists something. But indeed. As the set is random, the name findfirst does not make much sense. Still the feature is useful and I very much like the simplicity of the myfindfirst function
You can also use first(Iterators.filter(==(1), s)). Note that this throws an error if no match is found. You can use first(..., 1) to get a 1-element vector if it is found and a 0-element vector if not.