Add tutorial for macros
I could certainly walk through re-implementations of some of the basic macros. Should probably include nested templates, like defmacro/g/defmacro!. See if we can make the Lisp-2 macro work.
The first lesson is up #78.
There are still a number of TODOs in the macro tutorial source. Some of them seem outdated. The first two already cover a lot of ground, so additional lessons would have diminishing returns, but there are a few important techniques that still deserve mention. Some advanced macro techniques also applicable to Clojure or Common Lisp are perhaps already better covered elsewhere. Perhaps at most they deserve a link. However, some techniques are unique enough to Hissp (or Lissp) that they merit further tutorials.
In particular:
- The use of Extras. Maybe not stable enough, and already covered in the quickstart. Unique to Lissp.
- Metaprogramming the
_macro_object by implementing its__getattr__(e.g. the Lisp-2 technique). Unique to Hissp. - Pre-expansion and code walking. The original plan was for a code-walking
yieldmacro. I'm no longer certain if that is feasible, but we might be able to do better thanEnsue. I limited Hissp to two special forms in part to make this kind of thing easier. - Destructuring
fn. I put a lot of thought intolambda's parameters tuple to make this work better. This is pretty much unique to Hissp.
And easier lessons may be required to lead up to these.