@@ -48,9 +48,16 @@ (define-macro (rule . body) (let ([decl (car body)] [patterns (cdr body)]) `(define ,decl - (define-macro (@ . tree) (@rewrite-patterns tree)) + (define-macro (@ . tree) (@rewrite-patterns tree)) ;choice point + (define-macro (: . tree) (@rewrite-patterns (cons (list "") tree))) ;optional choice + (define-macro (? . tree) (@rewrite-patterns (cons (list "") (list tree)))) ;optional - TODO: rewrite ,(@rewrite-patterns patterns)))) - + ; generate simple word-banks + (define-macro (bank . body) + (let ([decl (car body)] + [patterns (cdr body)]) + `(define (,decl) + (one-of ,@patterns)))) (define (pick ar) (vector-ref ar (pseudo-random-integer (vector-length ar))))