(define-syntax generate-html-tag
(syntax-rules ()
((generate-html-tag x)
(define (x . args)
(delay
(begin
(display (string-append "<" (symbol->string 'x) ">"))
(for-each
(lambda (arg)
(cond
((string? arg) (display arg))
((promise? arg) (force arg))
(else '())))
args)
(display (string-append "" (symbol->string 'x) ">"))))))))
(generate-html-tag html)
(generate-html-tag head)
(generate-html-tag body)
(generate-html-tag p)
(force
(html
(head "This is a page head")
(body
(p "here is a paragraph")
(p "here is another"))))
;; above is now correct