View tree of expression stored in variable
I'm on Julia 1.0.3, TreeView 0.3.1 in an IJulia notebook:
julia> myexpr = :(1.0 * x[1] + -1.0 * x[2] + -1.0 * x[3])
julia> @tree @eval myexpr
LabelledTree({4, 3} directed simple Int64 graph, Any[:macrocall, Symbol("@eval"), :(#= In[21]:1 =#), :objexpr])
On a side note, it took me a moment to realize that I needed @eval here. If this usage is correct, perhaps there could be an example in the README. This may also be related to #19?!
Sorry; brew install pdf2svg.
Please feel free to suggest improvements for the README.
I got confused. The @eval trick doesn't work; it displays something else. How does one display an expression stored in a variable? Just call tree_walk(myexpr)?
This is currently not enabled via the macro, though it would be a useful addition, so I've reopened the issue and changed the title.
Indeed just calling the function is a good workaround.
Ok, thank you!
The syntax could be @tree $myexpr. This requires explicitly handling the relevant $ syntax in the expression parser and escaping the resulting variable.