#lang racket (define ++ string-append) (define (html id) (begin (set! id (symbol->string id)) (define otag (++ "<" id ">")) (define ctag (++ "</" id ">")) (lambda children (++ otag (apply ++ children) ctag)))) (define-syntax %% (syntax-rules (list begin) ((%% id (begin child ...)) ((html `id) child ...)) ((%% id (list opt ...)) (++ ((html `id) opt) ...)) ((%% id expr) ((html `id) expr)))) (%% ul (begin "hello" "there")) (%% ul (list "hello" "there"))