[cells-devel] c-formula and setf

Bastian Müller turbo24prg at web.de
Mon Feb 16 16:36:29 UTC 2009


Frank Goenninger wrote:

Hi Frank,

 > (wow - another Cells user in Germany ;-) - We're three now)
Heh.

 > As Kenny and Jakub have suggested one common solution I find myself
 > using from time to time is:
 >
 > (defmd frgo ()
 >   (entered-value (c-in nil))
 >   (value (c? (or (^entered-value)
 >                  (computed-value)))))
 >
 > (defun computed-value () ;;; Just making a simple function that fakes a
 > computed value
 >   'computed)
 >
 > (defun test-it ()
 >   (let ((self (make-instance 'frgo)))
 >     (format t "~&Entered value: ~s~%" (^entered-value))
 >     (format t "~&Value: ~s~%" (^value))
 >
 >     (setf (^entered-value) 'entered)
 >     (format t "~&Entered value: ~s~%" (^entered-value))
 >     (format t "~&Value: ~s~%" (^value))))
 >

That looks very good. When used with ":reader value" for the value slot 
and ":writer value" for the entered-value slot this works very well.

Thanks a lot!

Cheers,
   Bastian




More information about the cells-devel mailing list