[plt-scheme] How to get the source of procedure?

From: jos.koot at tiscali.nl (jos.koot at tiscali.nl)
Date: Mon May 15 12:27:14 EDT 2006

Jaime Vargas writes:
> Does PLT offers a way of inspecting the source code of procedure?

For example:
(module documented-lambda mzscheme
 (define-values (fun make-fun fun? fun-acc fun-mut)
  (make-struct-type 'fun #f 2 0 #f () #f 0))
 (define (inside-lambda x) (fun-acc x 1))
 (define-syntax doc-lambda
  (syntax-rules ()
   ((doc-lambda . whatever)
    (make-fun (lambda . whatever) '(lambda . whatever)))))
 (provide (rename doc-lambda lambda) inside-lambda))

(require documented-lambda)
(define x (lambda (monkey) billy))
(inside-lambda x) ; --> (lambda (monkey) billy)

Best wishes, Jos Koot





Posted on the users mailing list.