I’ve been playing around with rewriting julia expressions such that they evaluate lazily, while supporting arbitrary syntax. This is really useful to me for statically constructing complex computational graphs where only a subset of computations will ultimately be needed / performed.
I’ve noticed that there is already a notion of a thunk in Julia AST, although it’s not documented much. This link shows an example
While this link references the idea of a “toplevel thunk”:
I can see that
:thunk is used extensively in Julia itself, although I don’t fully grok if it’s “okay” for me as an end user to rewrite expressions with a :thunk head or if this is a Bad Idea™.
Would anyone be able to point me to anything I could read that might be illuminating, or have a moment to explain / offer context?