indexin takes a collection for both arguments, but since broadcasting is available most functions take a scalar. Why does this one take a collection for
Because it can be implemented more efficiently, by only doing one pass over both
b, resulting in
O(length(a) + length(b)) complexity instead of
O(length(a) * length(b)) complexity (at the cost of some extra allocation). See also its implementation.
I guess this could be implemented specially to have broadcasting do the same kind of magic, but it’d be quite a bit more tricky (plus, I think this method has been around for quite a while).