Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show function source code from repl [duplicate]

Tags:

julia

I would like to view the definition of a method in REPL. I follow this link (https://github.com/JuliaLang/julia/issues/2625) but it doesn't work:

julia> f(x) = x^2
f (generic function with 1 method)

julia> expand(f)
f (generic function with 1 method)

julia> methods(f)
# 1 method for generic function "f":
f(x) at REPL[155]:1

julia> implementation(f,1)
ERROR: UndefVarError: implementation not defined
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:64
 in macro expansion at ./REPL.jl:95 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:68

It seems that the method implementation doesn't exist.

like image 553
Phuoc Avatar asked Oct 18 '22 14:10

Phuoc


1 Answers

I believe a direct way isn't implemented yet.

Here's one of the creators saying so 6 months ago - doesn't seem to have been made, as there are a few duplicate issues of this.

https://stackoverflow.com/a/37662987/7754070

like image 132
miguel raz Avatar answered Nov 03 '22 23:11

miguel raz