How to display a function definition

This is probably a beginners question ... but is it possible to show the definition of a function (user-defined)? In the debugging / optimization process, it is convenient to quickly see how a particular function has been programmed.

Thanks in advance.

+4
source share
2 answers

You can use a macro @editthat is supposed to lead you to the definition of a method, similar to a macro @whichthat shows the file and line # where this 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

Please note that the methods included with Julia will show the path relative to the julia source directory.

+4
source

, Julia ( Stefan), docstrings , help?> docstring.

julia> """mytestfunction(a::Int, b)""" function mytestfunction(a::Int, b)
    return true 

docstring "mytestfunction (a:: Int, b)" mytestfunction(a::Int, b). , , " Julia" ( ? REPL), .

help?> mytestfunction 
    mytestfunction(a::Int, b)
+3

All Articles