here are some more examples in a hypothetical functional language:

  • the last bit is arguably unreadable. you could try to "refactor" that, but i think different code representations are necessary to make this kind of computation understandable. the simplest of which is to visualize the computation in a parallel view for a given example.
  • here, each is actually a function (map). the language pretty much only has functions and let bindings.
  • uniform abstract syntax is nice for language extension and other kinds of meta programming.
  • the key idea here is to have a surface syntax on top of the AST to make things prettier.