Hello all.
In R there is an easy way to view what a function does by typing the function name without parenthesis.
> manova
function (...)
{
Call <- fcall <- match.call()
fcall[[1L]] <- quote(stats::aov)
result <- eval(fcall, parent.frame())
if (inherits(result, "aovlist")) {
for (i in seq_along(result)) {
if (!inherits(result[[i]], "maov"))
stop("need multiple responses")
class(result[[i]]) <- c("manova", oldClass(result[[i]]))
}
attr(result, "call") <- Call
}
else {
if (!inherits(result, "maov"))
stop("need multiple responses")
class(result) <- c("manova", oldClass(result))
result$call <- Call
}
result
}
<bytecode: 0x12903cec0>
<environment: namespace:stats>
Is there a similar way to do this in Juila? I know if a function is typed by itself, it gives information about it, but not the internal workings of the function.
julia> using Statistics
julia> mean
mean (generic function with 6 methods)
In Julia, the only methods I know of viewing the internals of a function is by looking at the code repository or running the methods()
and looking at the contents of the listed files.
julia> methods(mean)
# 6 methods for generic function "mean":
[1] mean(r::AbstractRange{<:Real}) in Statistics at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Statistics/src/Statistics.jl:185
[2] mean(a::NamedArrays.NamedArray{T, N}; dims) where {T, N} in NamedArrays at /Users/user/.julia/packages/NamedArrays/TuJLn/src/changingnames.jl:16
[3] mean(A::AbstractArray; dims) in Statistics at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Statistics/src/Statistics.jl:164
[4] mean(itr) in Statistics at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Statistics/src/Statistics.jl:44
[5] mean(f, A::AbstractArray; dims) in Statistics at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Statistics/src/Statistics.jl:104
[6] mean(f, itr) in Statistics at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Statistics/src/Statistics.jl:61
Is there a way of brining up the function contents within julian mode?
Thank you for your help and time.