From: jsancho Date: Tue, 6 Sep 2011 18:54:06 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=795a520a3cf53edb41e17986e93d6b258d97a2d8;p=gacela.git --- diff --git a/src/gacela_mobs.scm b/src/gacela_mobs.scm index aeb65d9..1012301 100755 --- a/src/gacela_mobs.scm +++ b/src/gacela_mobs.scm @@ -191,6 +191,17 @@ (lambda () (look attr)) (lambda (key . args) #f))))))))) +(define-macro (define-mob mob-head . body) + (let ((name (car mob-head)) (attr (cdr mob-head))) + `(define ,(string->symbol (string-concatenate (list "make-" (symbol->string name)))) + (lambda-mob ,attr ,@body)))) + +(define-macro (lambda-mob attr . body) + `(lambda () + (let ,(cons '(mob-id (gentemp)) attr) + (lambda () + ,@body)))) + (define (get-mob-attr mob var) (let ((value (assoc-ref (mob 'get-attr) var)))