There might be better tricks, the best I know is that for any function
which was defined you can get to its AST:

julia> f() = sin(5)+7

julia> Base.uncompressed_ast(f.env.defs.func.code)
:($(Expr(:lambda, Any[], Any[Any[],Any[],0,Any[]], :(begin  # /tmp/t.jl, line 2:
        return (Main.sin)(5) + 7
    end))))

If you have several methods use `next` until there are no more:

julia> f(x) = x
f (generic function with 2 methods)

julia> Base.uncompressed_ast(f.env.defs.next.func.code)
:($(Expr(:lambda, Any[:x], Any[Any[Any[:x,:Any,0]],Any[],0,Any[]], :(begin  # 
none, line 1:
        return x
    end))))

I don't know about non-function code.

On Mon, 2016-07-11 at 13:18, Christopher Fisher <fishe...@miamioh.edu> wrote:
> I ran a script over the weekend. When I returned, the script ran and saved
> the results correctly. However, for some inexplicable reason I cannot find
> the script anywhere. I was wondering if it is possible to recover the
> script from my terminal session, which is still active. I used include( )
> to execute the script.
>
> Any help would be appreciated.
>
> Chris

Reply via email to