How to find the package to which a function belongs to

Viewed 144

Imagine you find in someone code a function (e.g. countfrom). How to find the package to which a function belongs to? In this case Iterators.

1 Answers

You can use the @which macro:

julia> using StatsBase

julia> @which countmap(rand(1:10, 100))
countmap(x::AbstractArray{T,N} where N; alg) where T in StatsBase at C:\Users\user\.julia\packages\StatsBase\548SN\src\counts.jl:389

Note that as the docs say, the macro actually evaluates the arguments to the specific call, as a function might have different methods defined in different places.

Related