[racket] What part of the Reader reads procedures?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Jun 10 01:28:04 EDT 2014

Procedures are unreadable, and `print-unreadable` does affect printing
in the default mode:

 > (print-unreadable #f)
 > (lambda (x) x)
 write: printing disabled for unreadable value
   value: #<procedure>

I see that Constructor and Quaisquote modes in DrRacket don't pay
attention to `print-unreadable`, though, and that may be confusing you.

There are various ways to change the printing of procedures, each with
some trade-offs. One option is to use `pretty-print` and set the
`pretty-print-size-hook` and `pretty-print-print-hook` parameters to
recognize 

At Mon, 9 Jun 2014 20:02:32 -0400, Daniel Brady wrote:
> In the documentation on the the Reader, I see all of the data types in
> Racket that I knew about (and more) have sections devoted to reading them,
> except for procedures. What part of the reader handles procedures?
> 
> In my Reader experiments I wanted to see if I could change the output of
> reading a procedure, like I could numbers and quoted values, but I couldn't
> figure out how to catch them.
> 
> They apparently aren't read via #%datum, and they aren't being treated as
> an 'unreadable value' because they display the same whether or not
> print-unreadable is turned on. The only difference in how the value of a
> procedure displays is through changing the output printing style of
> DrRacket itself, from print/write to constructor/quasiquote.
> 
> I don't want to change this mode, however; I'm just interested in changing
> the displayed value of evaluated procedures to a customized value, like
> "#<function>" instead of "#<procedure>" or something.
> 
> -- 
> *SEE YOU SPACE COWBOY...*
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.