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

From: Scott Klarenbach (scott at pointyhat.ca)
Date: Fri Dec 27 18:27:37 EST 2013

I noticed that MIT Scheme has the "pp" procedure which prints the source
code of a given function.  Is there an equivalent way to do this in Racket?

More generally, I'm looking to normalize nested procedures to their most
rudimentary expressions.

For example:

(define (something? x) (> x 3))
(define (something-else? x) (< x 10))
(define (combined x) (and (something? x) (something-else? x)))

(normalize combined) =>
'(lambda (x) (and (> x 3) (< x 10)))

((normalize combined) 7) => #t

I'm sure it's not so simple and a robust general solution involves some
type of beta reduction and/or argument constraints, but I'm just looking
for a nudge in the right direction.

Thanks.




-- 
Talk to you soon,

Scott Klarenbach

PointyHat Software Corp.
www.pointyhat.ca
p 604-568-4280
e scott at pointyhat.ca
200-1575 W. Georgia
Vancouver, BC V6G2V3

_______________________________________
To iterate is human; to recur, divine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20131227/d456552f/attachment.html>

Posted on the users mailing list.