but the situation is quite strange: if O(n) is the best we can possibly get, why hesitate to do so? After all, O(n) should be considered as “very good” for most algorithms…
now, using count is still O(n) (and with some overhead in the anonymous function). We just cannot avoid it…
I don’t think O(n) is very good for something like length, which is O(1) for vectors. The consequence of supporting, out of the box, length is that a lot of people will complain that length(skipmissing(x)) is slow, and they would be right, when thinking about other length calls.
skipmissing is designed to be a very lightweight and fast iterator which skips missing values. It comes with a guarantee “every function in Base which supports SkipMissing will be fast”. That unfortunately means it won’t support all common functions.