JavaScript? programmers are familiar with accessing the source code of a procedure at runtime. Can we do this in Scheme?
We would also like to store other meta-information about a procedure, say, to provide a documentation string for the procedure, similar to Emacs Lisp doc-strings.
The doc-lambda macro turns its source code into an S-expression by quoting it and storing it in a struct. It creates the actual procedure and stores that in the struct as well, along with the provided documentation string.
The struct is executable as a procedure thanks to MzScheme's "structs as procedures" (see chapter 4.6 in the MzScheme language manual): the final argument to make-struct-type tells MzScheme to treat the 0th item in the struct as the procedure to invoke when the struct is applied as a procedure.