(define (attach-tag type-tag contents) (cons type-tag contents)) (define-syntax bundle (syntax-rules (tag define) ((_ type (tag object)) (attach-tag 'type object)) ((_ type (define head body body* ...)) (define head (bundle type body body* ...))) ((_ type (proc proc* ...)) (proc (bundle type proc*) ...)) ((_ type proc) proc) ((_ type proc proc* ...) (begin (bundle type proc) (bundle type proc* ...))))) (define (put a b) (print "I have stuff: " a " " b " " (symbol? a))) ;; Example: (bundle hello (print "hello") (print (tag 'world))) ; => hello ; => (hello . world) (bundle hello (print (list (tag "hello") (tag "hello") (list (tag "hello") (tag "hello"))))) ; => ((hello . hello) (hello . hello) ((hello . hello) (hello . hello))) (bundle baz (define (foo) (tag 'bar)) (print (+ 2 4 5 6 7 8)) (put 'foof foo)) ; => 32 ; => I have stuff: (bundle baz foof) # #f ; ^ This should be just 'foof (bundle foo (print (tag 'bar) 'baz)) ; => (foo . bar)(bundle foo baz) ; ^ Why isn't this eval'd?