Skip to content

Instantly share code, notes, and snippets.

@dyoo
Created December 15, 2012 21:51
Show Gist options
  • Save dyoo/4299589 to your computer and use it in GitHub Desktop.
Save dyoo/4299589 to your computer and use it in GitHub Desktop.
another inspection example
#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