Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display the definition of a function

Tags:

julia

This is probably a newbie question... but is it possible to show the definition of a (user defined) function? While debugging/optimizing it is convenient to quickly see how a certain function was programmed.

Thanks in advance.

like image 680
InkPen Avatar asked Mar 12 '23 10:03

InkPen


1 Answers

You can use the @edit macro, which is supposed to take you to the definition of a method, similarly to how the @which macro which shows the file and line # where that particular method was defined, for example:

julia> @which push!(CDFBuf(),"foo")
push!{T<:CDF.CDFBuf}(buff::T, x) at /d/base/DA/DA.jl:105

julia> @which search("foobar","foo")
search(s::AbstractString, t::AbstractString) at strings/search.jl:146

Note that methods that are part of Julia will show a path relative to the julia source directory "base".

like image 154
Scott Jones Avatar answered Mar 19 '23 20:03

Scott Jones