(define-macro (show-mob mob)
- `(show-mob-hash ',mob (lambda (option) (,mob option))))
+ (cond ((list? mob)
+ `(let ((m ,mob))
+ (show-mob-hash (m 'get-mob-id) m)))
+ (else
+ `(show-mob-hash (,mob 'get-mob-id) (lambda () (,mob))))))
(define-macro (hide-mob mob)
`(hide-mob-hash ',mob))
(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)))
(define (set-mob-look! mob look)
(mob 'set-look look))
+
+
+
+
+
+(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 (gensym)) attr)
+ (lambda* (#:optional (option #f))
+ (case option
+ ((get-mob-id)
+ mob-id)
+ (else
+ (catch #t
+ (lambda () ,@body)
+ (lambda (key . args) #f))))))))