Welcome to the CHICKEN Scheme pasting service

Macro bug added by wxallowed on Sat Nov 13 02:16:56 2021

(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) #<procedure (foo)> #f
;                      ^ This should be just 'foof

(bundle foo
        (print (tag 'bar) 'baz))
; => (foo . bar)(bundle foo baz)
;                     ^ Why isn't this eval'd?

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Name of the egg which implements this service:
Visually impaired? Let me spell it for you (wav file) download WAV