[plt-scheme] behaviour example

From: Chris Gaskett (cgaskett at atr.co.jp)
Date: Thu Jan 29 21:27:30 EST 2004

It's getting easier to add behaviour my software.

For example, here is looking at hands when they are touched:

(module behaviour-touched-hand-look mzscheme
   (require "seeandreach.ss")
   (require "setable.ss")
   (require "pct.ss")

   (add-behaviour! 'touched-hand-look
                   (let ((touched-hand-threshold (getable 0.1))
                         (look-for-a-while (lambda (look-to)
                                             (thread (lambda ()
((look-previous (choice-current-symbol look-at-chooseable)))
                                                         (unless (eq? 
look-previous look-to)
(set-chooseable! 'look-at look-to)
                                                           (sleep 3)
(set-chooseable! 'look-at look-previous))))))))
                     (lambda ()
                       (cond ((> (abs (position-error L_WFE)) 
(touched-hand-threshold)) (look-for-a-while 'left-hand))
                             ((> (abs (position-error R_WFE)) 
(touched-hand-threshold)) (look-for-a-while 'right-hand))))))

just for your interest. Unfortunately the indentation will have been 
messed up by the mailer.


Chris Gaskett
cgaskett at atr.co.jp
OpenPGP key: http://www.cns.atr.co.jp/~cgaskett/Chris_Gaskett.asc
OpenPGP fingerprint: 297B B4BA D297 4252 F6C6 FA74 76D2 4293 022F 0955

Posted on the users mailing list.