Does inlining work when the function is passed as an argument?

Just wondering. For example

@inline function foo(x,y)
    @assert length(x) == length(y)
    x .+ y.*rand(length(y))
end

function apply_function(x,y,f)
    f(x,y)
end

julia> apply_function(rand(10), rand(10), foo)

Yes, it can get inlined (but be aware of https://docs.julialang.org/en/v1.5-dev/manual/performance-tips/#Be-aware-of-when-Julia-avoids-specializing-1).

As an aside, it’s a matter of convention to place function arguments first (even ahead of mutated arguments). This allows you to support do syntax.