I have a system upon which I need to apply a set of scalars which depend on their inputs. I’d like to, for debugging purposes be able to show a list of these scalars and the name of the function, which I think I should be able to do base on this sample code:
function scalars()
foo(x) = 1.0
bar(x) = 1.5
return [foo,bar]
end
map((f) -> (f,f(1)),scalars())
Outputs:
2-element Array{Tuple{Function,Float64},1}:
(getfield(Main, Symbol("#foo#38"))(), 1.0)
(getfield(Main, Symbol("#bar#39"))(), 1.5)
That is, I can see that the name is “available” now that I’m calling it outside of where I defined it. Ideally, I would like to have something like:
(foo, 1.0)
(bar, 1.5)
Is there some way I can cleanly get the name of the function without showing the getfield...
part?