This works with anonymous functions though:

julia> g = (x) -> x.^2
(anonymous function)

julia> g.code

AST(:($(Expr(:lambda, Any[:(x::Any)], Any[Any[Any[:x,:Any,0]],Any[],0,Any
[]], :(begin  # none, line 1:
        return x .^ 2
    end)))))





El martes, 26 de abril de 2016, 21:42:29 (UTC-5), Ismael Venegas Castelló 
escribió:
>
> Why is `f.code` an `UndefRefError`?
>
> julia> f.code
>
> ERROR: UndefRefError: access to undefined reference
>
>
>
> El martes, 26 de abril de 2016, 18:27:50 (UTC-5), Yichao Yu escribió:
>>
>> On Tue, Apr 26, 2016 at 6:39 PM,  <chobb...@gmail.com> wrote: 
>> > I wonder how to print the expression of a function, e.g. x.^2 for the 
>> > following example. 
>> > 
>> > julia> f(x) = x.^2 
>> > f (generic function with 1 method) 
>> > 
>> > julia> f 
>> > f (generic function with 1 method) 
>> > 
>> > If it is not possible for the expression of a function as simple as the 
>> > above to be printed, is there a way to display more info for a 
>> function, 
>> > instead of just the reference of the container f? 
>> > 
>> > I searched in the past threads and didn't any similar question. But 
>> this may 
>> > be the case because what I'm asking is, again, a dumb question. 
>> > 
>> > Thanks. 
>>
>>
>> http://julia.readthedocs.org/en/latest/search/?q=code_lowered&check_keywords=yes&area=default#
>>  
>>
>> > 
>> > Calvin 
>>
>

Reply via email to