Skip to content

Instantly share code, notes, and snippets.

@briochemc
Created February 12, 2019 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briochemc/db7faf3f116477091f02e31261e76350 to your computer and use it in GitHub Desktop.
Save briochemc/db7faf3f116477091f02e31261e76350 to your computer and use it in GitHub Desktop.
f1(x) = x
f2(x) = 2x
f3(x) = 3x
list_methods = [
("method1", :f1)
("method2", :f2)
("method3", :f3)
]
aDict = Dict()
for (method_name, f) in list_methods
local x, baz
x = 42
baz = :( foo = $f($x) )
eval(baz)
aDict[method_name] = foo
end
aDict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment