Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the package to which a function belongs to

Tags:

package

julia

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.

like image 900
sbac Avatar asked Oct 30 '25 15:10

sbac


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.

like image 122
Nils Gudat Avatar answered Nov 01 '25 14:11

Nils Gudat