[plt-scheme] Displaying the function body

From: Brian Sniffen (brian.sniffen at gmail.com)
Date: Tue Jan 4 11:09:56 EST 2005

On Thu, 9 Dec 2004 11:49:48 -0800, Dmitriy.Zavin at infineon.com
<Dmitriy.Zavin at infineon.com> wrote:

> I was wondering how one would go about displaying the function body of a
> function that is currently defined? (something equivalent to Tcl's
> "info body <func>"

It's not clear that it has one.  Many of the procedures in the
standard library are implemented in C -- for example, +.  These
primitive procedures don't have Scheme bodies to display.  Also, the
body of even a scheme-defined procedure may never have been written by
the programmer.  For example, consider this tiny procedure:

(define myproc
  (let ((+ -) (a 3))
    (lambda (x) (+ x a))))

What should be printed as its body?  Should it be different from the
body of this procedure below?

(define myproc
  ((lambda (+ a)
    (lambda (x) (+ x a)))
  - 3))

Brian T. Sniffen
bts at alum.mit.edu    or    brian.sniffen at gmail.com

Posted on the users mailing list.