[racket] How to view source code of procedures? MIT scheme "pp" equivalent?

From: Greg Hendershott (greghendershott at gmail.com)
Date: Sun Dec 29 10:32:17 EST 2013

On Sat, Dec 28, 2013 at 2:01 PM, Scott Klarenbach <scott at pointyhat.ca> wrote:
> It would be really nice to print the source code of a known procedure on the
> repl, in order to get a quick view of what it does.  Or, the "pa" function
> which prints out the arguments of a procedure is even more useful.

A few ideas here:

1. Geiser mode for Emacs provides both of these things.

2. The general way to go about this would be to use
`identifier-binding` to find the module(s) that define and provide the
thing, then search within the file to find the definition or provision.

A head start:
https://github.com/greghendershott/racket-mode/blob/master/defn.rkt

3. Another approach, as Neil mentioned, is to provide this capability
at least for functions you define yourself.

Starter using a struct with a procedure property (you could also use a
side dictionary for this):

http://stackoverflow.com/questions/20349543/how-do-you-return-the-description-of-a-procedure-in-scheme/20362858#20362858

As Neil mentioned you could create a #lang where `define` is your
special define of this sort.

Posted on the users mailing list.