schememit-scheme

How to obtain my function definition in MIT Scheme?


In JavaScript, I can retrieve the "source code" definition of a function, for example:

​function alert_Hi() {
    alert("Hi");
}

alert(alert_Hi);

will return exactly what I typed. http://jsfiddle.net/DuCqJ/

How can I do this in MIT Scheme?

I remember seeing something that returns #compound-procedure or something, but what I really want is the "source code".


Solution

  • You might try pp

    (define (display-hi) (display "Hi"))
    (pp display-hi) =>
    (named-lambda (display-hi)
      (display "Hi"))
    

    MIT-Scheme debugging aids