From: jsancho Date: Tue, 31 May 2011 19:48:07 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=8f832dbff1875ba4a6ba73974e1016378218a9c4;p=gacela.git --- diff --git a/src/gacela_mobs.scm b/src/gacela_mobs.scm index c0037f1..de527bd 100755 --- a/src/gacela_mobs.scm +++ b/src/gacela_mobs.scm @@ -19,6 +19,19 @@ ;;; Actions for mobs +(define-macro (define-action name attr . code) + `(define (,name mob-attr) + (let ,attr + ,@code + ,(cons 'begin (map #'attribute-save (reverse attr))) + mob-attr))) + +(defun attribute-save (attribute) + (let* ((name (cond ((listp attribute) (car attribute)) + (t attribute))) + (pname (attribute-name name))) + `(setf (getf object-attr ,pname) ,name))) + ;;; Mob Factory