Hi guys. Recently, I wrote a lambda calculus parser and interpreter
using guile's awesome compiler tower. It works relatively well, I'm able
to enter expressions in the REPL and they are correctly executed.
However, because of lambda calculus' nature, the interactive experience
is far from fun. Since everything is a function, when I try and test my
definition of addition of church encoded numbers, I'm met with an
unfriendly `#<procedure>'.
I wrote a `render-function' procedure which, given an #<procedure> from
the lambda calculus world, will return a friendly representation such as
`λa.λb.(b (b a))'
I thought, "there must be a way to convince the REPL to use this
function instead of the unhelpful `write'".
While looking at the spec.scm file in language/ecmascript, I saw the ";;
a pretty printer would be interesting" comment and was convinced that
the #:printer field was my solution, but after investigating further,
realized that it wasn't. In fact, if I understand correctly, there is
currently no way of telling the REPL how I want the result of an
expression printed.
I have two questions.
1. What was the motivation for the #:printer slot in (system base
language), if it isn't supposed to be used to print the result of
evaluation (according to (repl common)) ?
2. If I were to do a bit of hacking, maybe add a #:pretty-printer slot
and integrate it with the REPL, is that something that could get merged?
Thank you.