With lobstr::ast():
lobstr::ast(f(x, "y", 1))
#> █─f
#> ├─x
#> ├─"y"
#> └─1
- Some functions might also contain more calls like the example below:
f(g(1, 2), h(3, 4, i())):
lobstr::ast(f(g(1, 2), h(3, 4, i())))
#> █─f
#> ├─█─g
#> │ ├─1
#> │ └─2
#> └─█─h
#> ├─3
#> ├─4
#> └─█─i
- Read the hand-drawn diagrams from left-to-right (ignoring vertical position)
- Read the lobstr-drawn diagrams from top-to-bottom (ignoring horizontal position).
- The depth within the tree is determined by the nesting of function calls.
- Depth also determines evaluation order, as evaluation generally proceeds from deepest-to-shallowest, but this is not guaranteed because of lazy evaluation.