|Subject:||integrating pretty printing into the language and repl machinery|
|Date:||Mon, 20 Sep 2021 11:01:31 -0400|
|User-agent:||Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Icedove/78.12.0|
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?
|[Prev in Thread]||Current Thread||[Next in Thread]|