metaprogramming - Is there a fast way of going from a symbol to a function call in Julia? -


this question has answer here:

i know can call functions using name follows

f = x -> println(x) y = :f eval(:($y("hi"))) 

but slow since using eval possible in different way? know it's easy go other direction doing symbol(f).

what trying accomplish? needing eval symbol sounds solution in search of problem. in particular, can pass around original function, thereby avoiding issues needing track scope of f (or, since f ordinary variable in example, possibility reassigned), , fewer characters type:

f = x -> println(x) g = f g("hi") 

i know it's easy go other direction doing symbol(f).

this misleading, since it's not going give f (that transform non-unique). instead gives string representation function (which might happen f, sometimes). equivalent calling symbol(string(f)), since combination common enough useful other purposes.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo