Created
December 15, 2012 21:51
-
-
Save dyoo/4299589 to your computer and use it in GitHub Desktop.
another inspection example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define child-insp (make-inspector (current-inspector))) | |
(define parent-insp (current-inspector)) | |
;; Switch to the child inspector. Structures defined next | |
;; will be under its control. | |
(current-inspector child-insp) | |
(struct cat ()) | |
(struct moose ()) | |
(struct lynx ()) | |
(define animals (list (cat) (moose) (lynx))) | |
;; Switch back to the parent inspector, which has authority over | |
;; reflection on things made in the child-inpector's context. | |
(current-inspector parent-insp) | |
(map (lambda (v) | |
(define-values (type skipped?) | |
(struct-info v)) | |
type) | |
animals) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment