procgen  Diff

Differences From Artifact [517500dd79]:

To Artifact [26ba00c622]:


    45     45   	; generates a function that picks and applies one of the
    46     46   	; patterns passed to it. inner patterns can be expanded
    47     47   	; with the inner macro (@)
    48     48   	(define-macro (rule . body)
    49     49   				  (let ([decl (car body)]
    50     50   						[patterns (cdr body)])
    51     51   					`(define ,decl
    52         -					   (define-macro (@ . tree) (@rewrite-patterns tree))
           52  +					   (define-macro (@ . tree) (@rewrite-patterns tree)) ;choice point
           53  +					   (define-macro (: . tree) (@rewrite-patterns (cons (list "") tree))) ;optional choice
           54  +					   (define-macro (? . tree) (@rewrite-patterns (cons (list "") (list tree)))) ;optional - TODO: rewrite
    53     55   					   ,(@rewrite-patterns patterns))))
    54         -
           56  +	; generate simple word-banks
           57  +	(define-macro (bank . body)
           58  +				  (let ([decl (car body)]
           59  +						[patterns (cdr body)])
           60  +					`(define (,decl)
           61  +							 (one-of ,@patterns))))
    55     62   	(define (pick ar)
    56     63   		(vector-ref ar (pseudo-random-integer (vector-length ar))))