Is it also possible to get a list of names of the variables used in a
function?
e.g. for
function f(x,y)
k=0.1
return x*y+k
end
I'd like to get a list ["k","x","y"]
My first thought was to make a method f() that returns this list, but if
its possible to do this otherwise and more generally that would be very
useful
On Thursday, January 21, 2016 at 6:47:38 PM UTC+1, [email protected] wrote:
>
> Great, thanks a lot.
> In fact, I also need to evaluate the number of arguments of an anonymous
> function:
>
> julia> function factory(y)
> return x -> x + y
> end
> factory (generic function with 1 method)
>
> julia> type Foo
> f::Function
> end
>
> julia> foo = Foo(factory(2))
> Foo((anonymous function))
>
> julia> methods(foo.f)
> ERROR: ArgumentError: argument is not a generic function
> in methods at reflection.jl:180
>
>
> Any way to do that..?
>
>