From download at hpc.unm.edu Tue Apr 17 17:18:07 2012 From: download at hpc.unm.edu (Jim Prewett) Date: Tue, 17 Apr 2012 11:18:07 -0600 (MDT) Subject: [cells-devel] How to get started? Message-ID: Hello, I've recently stumbled across Cells and it sounds pretty interesting. I'm wondering how to get started learning about how to use Cells. In general, I've got several Lisp projects that could use a GUI and the various Cells-based GUI projects look interesting to me. I think I should probably learn how to use Cells (at some basic level) before trying to dive into one of the GUI packages. Is there a Cells-based GUI package that is currently preferred? In general, I learn best by first following a simple example, then modifying it to do my bidding. Can someone show me how to get started? I'm also wondering if someone can explain the difference between DEFMODEL and DEFMD to me. Thanks so much!, Jim James E. Prewett Jim at Prewett.org download at hpc.unm.edu Systems Team Leader LoGS: http://www.hpc.unm.edu/~download/LoGS/ Designated Security Officer OpenPGP key: pub 1024D/31816D93 HPC Systems Engineer III UNM HPC 505.277.8210 From frgo at me.com Tue Apr 17 18:12:56 2012 From: frgo at me.com (Frank Goenninger) Date: Tue, 17 Apr 2012 20:12:56 +0200 Subject: [cells-devel] How to get started? In-Reply-To: References: Message-ID: <4DAC8F62-C40E-4557-91C8-C0E3AF2907AC@me.com> Hi Jim, Am 17.04.2012 um 19:18 schrieb Jim Prewett: > Hello, > > I've recently stumbled across Cells and it sounds pretty interesting. I'm > wondering how to get started learning about how to use Cells. In general, > I've got several Lisp projects that could use a GUI and the various > Cells-based GUI projects look interesting to me. I think I should > probably learn how to use Cells (at some basic level) before trying to > dive into one of the GUI packages. Is there a Cells-based GUI package > that is currently preferred? Celtk is running fine here, also Cells-Gtk is still in use AFAIK. > In general, I learn best by first following a simple example, then > modifying it to do my bidding. Can someone show me how to get started? https://github.com/kennytilton/cells/wiki > I'm also wondering if someone can explain the difference between DEFMODEL > and DEFMD to me. defmodel is like defclass - with just a few more slot options to declare a cell. defmd is a convenience macro that helps in writing less boilerplate code: With defmodel a cellsified class might look like this: (DEFMODEL CAT (MODEL) ((NAME :INITFORM NIL :INITARG :NAME) (FUR-COLOR :INITFORM NIL :INITARG :FUR-COLOR) (TITLE :INITARG :TITLE :INITFORM (C? (UTILS-KT::CONC$ (^NAME) " with " (^FUR-COLOR) " fur.")))) (:DEFAULT-INITARGS :NAME (C-IN "") :FUR-COLOR (C-IN "black"))) the same could be written as: (defmd cat () name fur-color (title (c? (utils-kt::conc$ (^name) " with " (^fur-color) " fur."))) :name (c-in "") :fur-color (c-in "black")) ... the above is just part of the macroexpansion of this short form ... A very short demo with the above: CL-USER: (defvar *the-cat*) *THE-CAT* CL-USER: (setq *the-cat* (make-instance 'cat :name (c-in "Susi"))) CAT0 CL-USER: (title *the-cat*) "Susi with black fur." > > Thanks so much!, > Jim Hope that helps ;-) Cheers Frank From mirko.vukovic at gmail.com Tue Apr 17 18:17:22 2012 From: mirko.vukovic at gmail.com (Mirko Vukovic) Date: Tue, 17 Apr 2012 14:17:22 -0400 Subject: [cells-devel] can one make dependencies between models? Message-ID: Hello, I am doing very basic cell-stuff, much like the ones in the doc folder: Not liking excel and its cousins, I am implementing spread-sheet like calculations in cells. My question: 1) Can I build two models (model1, model2) and specify that a slot in model2 depends on changes in some other slot in model1? 2) Related: can I change a slot specification in a model. For example from `c-in' to `c?'. I assume that I can, but I would have to re-initialize the model somehow. Correct? I am also very interested in the question posted just a few minutes ago. I would like to build an automated way of generating a GUI front end my cell models. Thanks, Mirko -------------- next part -------------- An HTML attachment was scrubbed... URL: From frgo at me.com Tue Apr 17 21:08:14 2012 From: frgo at me.com (Frank Goenninger) Date: Tue, 17 Apr 2012 23:08:14 +0200 Subject: [cells-devel] can one make dependencies between models? In-Reply-To: References: Message-ID: Hi Mirko, Am 17.04.2012 um 20:17 schrieb Mirko Vukovic: > Hello, > > I am doing very basic cell-stuff, much like the ones in the doc folder: Not liking excel and its cousins, I am implementing spread-sheet like calculations in cells. > > My question: > > 1) Can I build two models (model1, model2) and specify that a slot in model2 depends on changes in some other slot in model1? Sure: (in-package #:cells) ;;; ------------------ ;;; *** Model M1 *** ;;; ------------------ (defmd m1 () a b :a (c-in 1) :b (c-in 1)) (defobserver a ((self m1)) (when new-value (format *debug-io* "~%~S: New value for slot a => ~S." self (a self)))) (defobserver b ((self m1)) (when new-value (format *debug-io* "~%~S: New value for slot b => ~S." self (b self)))) (defmacro mk-m1 (id) `(make-instance 'm1 :fm-parent *parent* :md-name ,id)) ;;; ------------------ ;;; *** Model M2 *** ;;; ------------------ (defmd m2 () (c (c? (let ((m1 (fm^ :m1))) ;; -> fm^ searches for :m1 in the current family (* (a m1) (b m1)))))) (defmacro mk-m2 (id) `(make-instance 'm2 :fm-parent *parent* :md-name ,id)) (defobserver c ((self m2)) (when new-value (format *debug-io* "~%~S: New value for slot c => ~S." self (c self)))) ;;; ------------------ ;;; *** Family M *** ;;; ------------------ (defmd m (family) (kids (c? (the-kids (mk-m1 :m1) (mk-m2 :m2)))) ;; :m1 and :m2 are kids of :m's family. :md-name :m) ;;; ----------------- ;;; *** TESTING *** ;;; ----------------- (defun m-test () (let* ((self (make-instance 'm)) (m1 (fm-find-kid self :m1))) ;; Step 1 (format *debug-io* "~%~%STEP 1~&") (setf (a m1) 2) ;; => C = 2 ;; See observer for C ! ;; Step 2 (format *debug-io* "~%~%STEP 2 ~&") (setf (b m1) 3)) ;; => C = 6 ;; See observer for C ! (values)) > 2) Related: can I change a slot specification in a model. For example from `c-in' to `c?'. I assume that I can, but I would have to re-initialize the model somehow. Correct? This one I'd like to leave for Kenny to answer ... Never did that during one run - I always reset cells via #'cells-reset and the started over when I needed to do that. > I am also very interested in the question posted just a few minutes ago. I would like to build an automated way of generating a GUI front end my cell models. I tried to answer this in the other mail. > > Thanks, > > Mirko Hope that helps. Cheers Frank From frgo at me.com Tue Apr 17 21:13:51 2012 From: frgo at me.com (Frank Goenninger) Date: Tue, 17 Apr 2012 23:13:51 +0200 Subject: [cells-devel] can one make dependencies between models? In-Reply-To: References: Message-ID: ... Output of the short demo below: (m-test) M1: New value for slot a => 1. M1: New value for slot b => 1. M2: New value for slot c => 1. STEP 1 M1: New value for slot a => 2. M2: New value for slot c => 2. STEP 2 M1: New value for slot b => 3. M2: New value for slot c => 6. ... cute, ha ? ;-))) Frank Am 17.04.2012 um 23:08 schrieb Frank Goenninger: > Hi Mirko, > > Am 17.04.2012 um 20:17 schrieb Mirko Vukovic: > >> Hello, >> >> I am doing very basic cell-stuff, much like the ones in the doc folder: Not liking excel and its cousins, I am implementing spread-sheet like calculations in cells. >> >> My question: >> >> 1) Can I build two models (model1, model2) and specify that a slot in model2 depends on changes in some other slot in model1? > > Sure: > > (in-package #:cells) > > ;;; ------------------ > ;;; *** Model M1 *** > ;;; ------------------ > > (defmd m1 () > a > b > :a (c-in 1) > :b (c-in 1)) > > (defobserver a ((self m1)) > (when new-value > (format *debug-io* "~%~S: New value for slot a => ~S." > self (a self)))) > > (defobserver b ((self m1)) > (when new-value > (format *debug-io* "~%~S: New value for slot b => ~S." > self (b self)))) > > (defmacro mk-m1 (id) > `(make-instance 'm1 > :fm-parent *parent* > :md-name ,id)) > > ;;; ------------------ > ;;; *** Model M2 *** > ;;; ------------------ > > (defmd m2 () > (c (c? (let ((m1 (fm^ :m1))) ;; -> fm^ searches for :m1 in the current family > (* (a m1) (b m1)))))) > > (defmacro mk-m2 (id) > `(make-instance 'm2 > :fm-parent *parent* > :md-name ,id)) > > (defobserver c ((self m2)) > (when new-value > (format *debug-io* "~%~S: New value for slot c => ~S." > self (c self)))) > > ;;; ------------------ > ;;; *** Family M *** > ;;; ------------------ > > (defmd m (family) > (kids (c? (the-kids > (mk-m1 :m1) > (mk-m2 :m2)))) ;; :m1 and :m2 are kids of :m's family. > :md-name :m) > > ;;; ----------------- > ;;; *** TESTING *** > ;;; ----------------- > > (defun m-test () > > (let* ((self (make-instance 'm)) > (m1 (fm-find-kid self :m1))) > > ;; Step 1 > (format *debug-io* "~%~%STEP 1~&") > (setf (a m1) 2) > ;; => C = 2 > ;; See observer for C ! > > ;; Step 2 > (format *debug-io* "~%~%STEP 2 ~&") > (setf (b m1) 3)) > ;; => C = 6 > ;; See observer for C ! > > (values)) > > >> 2) Related: can I change a slot specification in a model. For example from `c-in' to `c?'. I assume that I can, but I would have to re-initialize the model somehow. Correct? > > This one I'd like to leave for Kenny to answer ... Never did that during one run - I always reset cells via #'cells-reset and the started over when I needed to do that. > >> I am also very interested in the question posted just a few minutes ago. I would like to build an automated way of generating a GUI front end my cell models. > > I tried to answer this in the other mail. > >> >> Thanks, >> >> Mirko > > Hope that helps. > > Cheers > Frank > From peter.hildebrandt at gmail.com Tue Apr 17 22:42:03 2012 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Tue, 17 Apr 2012 15:42:03 -0700 Subject: [cells-devel] How to get started? In-Reply-To: <4DAC8F62-C40E-4557-91C8-C0E3AF2907AC@me.com> References: <4DAC8F62-C40E-4557-91C8-C0E3AF2907AC@me.com> Message-ID: Hi Jim, cells-gtk and celtk are probably the best choices for desktop GUI toolkits. You probably want to look at both to decide which you prefer. (full disclaimer, I did a bit of work on cells-gtk). Cells-gtk has the advantage of looking native on Ubuntu/Gnome (and is somewhat portable to windows). Celtk is more cross-platform and has a lower threshold if you are familiar with Tk. you can download the latest fork of cells-gtk3 here: https://github.com/Ramarren/cells-gtk3 Let me know if you have questions. Peter On Tue, Apr 17, 2012 at 11:12 AM, Frank Goenninger wrote: > Hi Jim, > > Am 17.04.2012 um 19:18 schrieb Jim Prewett: > >> Hello, >> >> I've recently stumbled across Cells and it sounds pretty interesting. ?I'm >> wondering how to get started learning about how to use Cells. ?In general, >> I've got several Lisp projects that could use a GUI and the various >> Cells-based GUI projects look interesting to me. ?I think I should >> probably learn how to use Cells (at some basic level) before trying to >> dive into one of the GUI packages. ?Is there a Cells-based GUI package >> that is currently preferred? > > Celtk is running fine here, also Cells-Gtk is still in use AFAIK. > >> In general, I learn best by first following a simple example, then >> modifying it to do my bidding. ?Can someone show me how to get started? > > https://github.com/kennytilton/cells/wiki > >> I'm also wondering if someone can explain the difference between DEFMODEL >> and DEFMD to me. > > defmodel is like defclass - with just a few more slot options to declare a cell. > defmd is a convenience macro that helps in writing less boilerplate code: > > With defmodel a cellsified class might look like this: > > (DEFMODEL CAT (MODEL) > ? ? ? ? ? ? ? ? ((NAME :INITFORM NIL :INITARG :NAME) > ? ? ? ? ? ? ? ? ?(FUR-COLOR :INITFORM NIL :INITARG :FUR-COLOR) > ? ? ? ? ? ? ? ? ?(TITLE :INITARG :TITLE :INITFORM > ? ? ? ? ? ? ? ? ? ? ? ? (C? (UTILS-KT::CONC$ (^NAME) " with " (^FUR-COLOR) " fur.")))) > ? ? ? ? ? ? ? ? (:DEFAULT-INITARGS > ? ? ? ? ? ? ? ? ? ? ? :NAME (C-IN "") > ? ? ? ? ? ? ? ? ? ? ? :FUR-COLOR (C-IN "black"))) > > the same could be written as: > > (defmd cat () > ? ? ? ? ? ? ?name > ? ? ? ? ? ? ?fur-color > ? ? ? ? ? ? ?(title (c? (utils-kt::conc$ (^name) " with " (^fur-color) " fur."))) > ? ? ? ? ? ? ?:name (c-in "") > ? ? ? ? ? ? ?:fur-color (c-in "black")) > > ... the above is just part of the macroexpansion of this short form ... > > A very short demo with the above: > > CL-USER: (defvar *the-cat*) > *THE-CAT* > > CL-USER: (setq *the-cat* (make-instance 'cat :name (c-in "Susi"))) > CAT0 > > CL-USER: (title *the-cat*) > "Susi with black fur." > >> >> Thanks so much!, >> Jim > > Hope that helps ;-) > > Cheers > ? ?Frank > > > _______________________________________________ > cells-devel site list > cells-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cells-devel From peter.hildebrandt at gmail.com Tue Apr 17 22:57:55 2012 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Tue, 17 Apr 2012 15:57:55 -0700 Subject: [cells-devel] can one make dependencies between models? In-Reply-To: References: Message-ID: > I am also very interested in the question posted just a few minutes ago.? I > would like to build an automated way of generating a GUI front end my cell > models. I used cells-gtk3 for exactly this purpose, i.e. linking the position/text/color of graphic elements to the state of cells models. Depending on your objectives, some of the more complex widgets might be very helpful: - a treeview that reflects a hierarchical object structure (supporting drag and drop if I recall correctly) - a listview (grid) that shows slots of models in a list (can even be editable) - a canvas (based on cairo) that can be populated by visual primitives (boxes, circles, lines, text fields) that mirror cells models (e.g. start point of a line can be linked to the position of a box, and if the user drags/drops the box, the line follows like a connector) Let me know if you have further questions. I wrote a fairly complex application using cells/cells-gtk (including a simple physics simulator using cells-ode and opengl), and I'm happy to dig up sample code if needed. Peter > > Thanks, > > Mirko > > _______________________________________________ > cells-devel site list > cells-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cells-devel From mirko.vukovic at gmail.com Wed Apr 18 03:29:58 2012 From: mirko.vukovic at gmail.com (Mirko Vukovic) Date: Tue, 17 Apr 2012 23:29:58 -0400 Subject: [cells-devel] can one make dependencies between models? In-Reply-To: References: Message-ID: Thank you very much Frank, I think I got it. A follow-up question. With this technique, I have several models, and the data is flowing from one model to the next. Nice. But is there a suggested procedure to temporarily isolate the model, so that it can be tested by itself? In other words, can one explicitly set values to cells whose initform defines them in terms of other model's slots. I tried setf on a cell that was linked to another model. It seems to work. But, is its initform (c? (let ((m (fm^ :other-model))) (blah (slot m) ...))) still active? How can I test that? By forcing that model to recompute itself. How do I do that? I did not find an obvious candidate in the exported symbols. Thanks again, Mirko On Tue, Apr 17, 2012 at 5:13 PM, Frank Goenninger wrote: > ... Output of the short demo below: > > (m-test) > > M1: New value for slot a => 1. > M1: New value for slot b => 1. > M2: New value for slot c => 1. > > STEP 1 > > M1: New value for slot a => 2. > M2: New value for slot c => 2. > > STEP 2 > > M1: New value for slot b => 3. > M2: New value for slot c => 6. > > ... cute, ha ? > > ;-))) > > Frank > > Am 17.04.2012 um 23:08 schrieb Frank Goenninger: > > > Hi Mirko, > > > > Am 17.04.2012 um 20:17 schrieb Mirko Vukovic: > > > >> Hello, > >> > >> I am doing very basic cell-stuff, much like the ones in the doc folder: > Not liking excel and its cousins, I am implementing spread-sheet like > calculations in cells. > >> > >> My question: > >> > >> 1) Can I build two models (model1, model2) and specify that a slot in > model2 depends on changes in some other slot in model1? > > > > Sure: > > > > (in-package #:cells) > > > > ;;; ------------------ > > ;;; *** Model M1 *** > > ;;; ------------------ > > > > (defmd m1 () > > a > > b > > :a (c-in 1) > > :b (c-in 1)) > > > > (defobserver a ((self m1)) > > (when new-value > > (format *debug-io* "~%~S: New value for slot a => ~S." > > self (a self)))) > > > > (defobserver b ((self m1)) > > (when new-value > > (format *debug-io* "~%~S: New value for slot b => ~S." > > self (b self)))) > > > > (defmacro mk-m1 (id) > > `(make-instance 'm1 > > :fm-parent *parent* > > :md-name ,id)) > > > > ;;; ------------------ > > ;;; *** Model M2 *** > > ;;; ------------------ > > > > (defmd m2 () > > (c (c? (let ((m1 (fm^ :m1))) ;; -> fm^ searches for :m1 in the > current family > > (* (a m1) (b m1)))))) > > > > (defmacro mk-m2 (id) > > `(make-instance 'm2 > > :fm-parent *parent* > > :md-name ,id)) > > > > (defobserver c ((self m2)) > > (when new-value > > (format *debug-io* "~%~S: New value for slot c => ~S." > > self (c self)))) > > > > ;;; ------------------ > > ;;; *** Family M *** > > ;;; ------------------ > > > > (defmd m (family) > > (kids (c? (the-kids > > (mk-m1 :m1) > > (mk-m2 :m2)))) ;; :m1 and :m2 are kids of :m's family. > > :md-name :m) > > > > ;;; ----------------- > > ;;; *** TESTING *** > > ;;; ----------------- > > > > (defun m-test () > > > > (let* ((self (make-instance 'm)) > > (m1 (fm-find-kid self :m1))) > > > > ;; Step 1 > > (format *debug-io* "~%~%STEP 1~&") > > (setf (a m1) 2) > > ;; => C = 2 > > ;; See observer for C ! > > > > ;; Step 2 > > (format *debug-io* "~%~%STEP 2 ~&") > > (setf (b m1) 3)) > > ;; => C = 6 > > ;; See observer for C ! > > > > (values)) > > > > > >> 2) Related: can I change a slot specification in a model. For example > from `c-in' to `c?'. I assume that I can, but I would have to > re-initialize the model somehow. Correct? > > > > This one I'd like to leave for Kenny to answer ... Never did that during > one run - I always reset cells via #'cells-reset and the started over when > I needed to do that. > > > >> I am also very interested in the question posted just a few minutes > ago. I would like to build an automated way of generating a GUI front end > my cell models. > > > > I tried to answer this in the other mail. > > > >> > >> Thanks, > >> > >> Mirko > > > > Hope that helps. > > > > Cheers > > Frank > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mirko.vukovic at gmail.com Wed Apr 18 03:32:02 2012 From: mirko.vukovic at gmail.com (Mirko Vukovic) Date: Tue, 17 Apr 2012 23:32:02 -0400 Subject: [cells-devel] can one make dependencies between models? In-Reply-To: References: Message-ID: Thanks Peter. That activity is still in the future. But from my own historical perspective, the very reason I switched to lisp several years ago was the desire for such self-GUI-fying models. I had a blast lisping, but never got to this original goal :-) On Tue, Apr 17, 2012 at 6:57 PM, Peter Hildebrandt < peter.hildebrandt at gmail.com> wrote: > > I am also very interested in the question posted just a few minutes > ago. I > > would like to build an automated way of generating a GUI front end my > cell > > models. > > I used cells-gtk3 for exactly this purpose, i.e. linking the > position/text/color of graphic elements to the state of cells models. > > Depending on your objectives, some of the more complex widgets might > be very helpful: > - a treeview that reflects a hierarchical object structure (supporting > drag and drop if I recall correctly) > - a listview (grid) that shows slots of models in a list (can even be > editable) > - a canvas (based on cairo) that can be populated by visual primitives > (boxes, circles, lines, text fields) that mirror cells models (e.g. > start point of a line can be linked to the position of a box, and if > the user drags/drops the box, the line follows like a connector) > > Let me know if you have further questions. I wrote a fairly complex > application using cells/cells-gtk (including a simple physics > simulator using cells-ode and opengl), and I'm happy to dig up sample > code if needed. > > Peter > > > > > > Thanks, > > > > Mirko > > > > _______________________________________________ > > cells-devel site list > > cells-devel at common-lisp.net > > http://common-lisp.net/mailman/listinfo/cells-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From frgo at me.com Wed Apr 18 08:39:35 2012 From: frgo at me.com (Frank Goenninger) Date: Wed, 18 Apr 2012 10:39:35 +0200 Subject: [cells-devel] can one make dependencies between models? In-Reply-To: References: Message-ID: Am 18.04.2012 um 05:29 schrieb Mirko Vukovic: > But is there a suggested procedure to temporarily isolate the model, so that it can be tested by itself? In other words, can one explicitly set values to cells whose initform defines them in terms of other model's slots. > > I tried setf on a cell that was linked to another model. It seems to work. How exactly did you do the setf ? > But, is its initform (c? (let ((m (fm^ :other-model))) (blah (slot m) ...))) still active? What does the inspection of your model and the cells slot reveal ? > How can I test that? By forcing that model to recompute itself. How do I do that? I did not find an obvious candidate in the exported symbols. Recalculation is simply forced by "reading" / accessing a cells slot... As soon as you say (c? (some-slot model)) or even just do a (format ..."~s" (some-slot model)) this triggers a recompute cycle in cells - the slot needs to be current to be correct so Cells triggers all dependencies... > > Thanks again, > > Mirko Frank > On Tue, Apr 17, 2012 at 5:13 PM, Frank Goenninger wrote: > ... Output of the short demo below: > > (m-test) > > M1: New value for slot a => 1. > M1: New value for slot b => 1. > M2: New value for slot c => 1. > > STEP 1 > > M1: New value for slot a => 2. > M2: New value for slot c => 2. > > STEP 2 > > M1: New value for slot b => 3. > M2: New value for slot c => 6. > > ... cute, ha ? > > ;-))) > > Frank > > Am 17.04.2012 um 23:08 schrieb Frank Goenninger: > > > Hi Mirko, > > > > Am 17.04.2012 um 20:17 schrieb Mirko Vukovic: > > > >> Hello, > >> > >> I am doing very basic cell-stuff, much like the ones in the doc folder: Not liking excel and its cousins, I am implementing spread-sheet like calculations in cells. > >> > >> My question: > >> > >> 1) Can I build two models (model1, model2) and specify that a slot in model2 depends on changes in some other slot in model1? > > > > Sure: > > > > (in-package #:cells) > > > > ;;; ------------------ > > ;;; *** Model M1 *** > > ;;; ------------------ > > > > (defmd m1 () > > a > > b > > :a (c-in 1) > > :b (c-in 1)) > > > > (defobserver a ((self m1)) > > (when new-value > > (format *debug-io* "~%~S: New value for slot a => ~S." > > self (a self)))) > > > > (defobserver b ((self m1)) > > (when new-value > > (format *debug-io* "~%~S: New value for slot b => ~S." > > self (b self)))) > > > > (defmacro mk-m1 (id) > > `(make-instance 'm1 > > :fm-parent *parent* > > :md-name ,id)) > > > > ;;; ------------------ > > ;;; *** Model M2 *** > > ;;; ------------------ > > > > (defmd m2 () > > (c (c? (let ((m1 (fm^ :m1))) ;; -> fm^ searches for :m1 in the current family > > (* (a m1) (b m1)))))) > > > > (defmacro mk-m2 (id) > > `(make-instance 'm2 > > :fm-parent *parent* > > :md-name ,id)) > > > > (defobserver c ((self m2)) > > (when new-value > > (format *debug-io* "~%~S: New value for slot c => ~S." > > self (c self)))) > > > > ;;; ------------------ > > ;;; *** Family M *** > > ;;; ------------------ > > > > (defmd m (family) > > (kids (c? (the-kids > > (mk-m1 :m1) > > (mk-m2 :m2)))) ;; :m1 and :m2 are kids of :m's family. > > :md-name :m) > > > > ;;; ----------------- > > ;;; *** TESTING *** > > ;;; ----------------- > > > > (defun m-test () > > > > (let* ((self (make-instance 'm)) > > (m1 (fm-find-kid self :m1))) > > > > ;; Step 1 > > (format *debug-io* "~%~%STEP 1~&") > > (setf (a m1) 2) > > ;; => C = 2 > > ;; See observer for C ! > > > > ;; Step 2 > > (format *debug-io* "~%~%STEP 2 ~&") > > (setf (b m1) 3)) > > ;; => C = 6 > > ;; See observer for C ! > > > > (values)) > > > > > >> 2) Related: can I change a slot specification in a model. For example from `c-in' to `c?'. I assume that I can, but I would have to re-initialize the model somehow. Correct? > > > > This one I'd like to leave for Kenny to answer ... Never did that during one run - I always reset cells via #'cells-reset and the started over when I needed to do that. > > > >> I am also very interested in the question posted just a few minutes ago. I would like to build an automated way of generating a GUI front end my cell models. > > > > I tried to answer this in the other mail. > > > >> > >> Thanks, > >> > >> Mirko > > > > Hope that helps. > > > > Cheers > > Frank > > > > From kentilton at gmail.com Wed Apr 18 18:28:36 2012 From: kentilton at gmail.com (Ken Tilton) Date: Wed, 18 Apr 2012 14:28:36 -0400 Subject: [cells-devel] How to get started? In-Reply-To: References: <4DAC8F62-C40E-4557-91C8-C0E3AF2907AC@me.com> Message-ID: Hey, thx everyone for pitching in. I spend most of my time as ktilton @ mcna dot net (and the google "easy account switching" kinda did not work so well when I tried it, tho it seems they are working on it). I agree with all said and would add only that the regression test suite has good examples. -kt On Tue, Apr 17, 2012 at 6:42 PM, Peter Hildebrandt wrote: > Hi Jim, > > cells-gtk and celtk are probably the best choices for desktop GUI > toolkits. ?You probably want to look at both to decide which you > prefer. ?(full disclaimer, I did a bit of work on cells-gtk). > Cells-gtk has the advantage of looking native on Ubuntu/Gnome (and is > somewhat portable to windows). ?Celtk is more cross-platform and has a > lower threshold if you are familiar with Tk. > > you can download the latest fork of cells-gtk3 here: > https://github.com/Ramarren/cells-gtk3 > > Let me know if you have questions. > Peter > > > On Tue, Apr 17, 2012 at 11:12 AM, Frank Goenninger wrote: >> Hi Jim, >> >> Am 17.04.2012 um 19:18 schrieb Jim Prewett: >> >>> Hello, >>> >>> I've recently stumbled across Cells and it sounds pretty interesting. ?I'm >>> wondering how to get started learning about how to use Cells. ?In general, >>> I've got several Lisp projects that could use a GUI and the various >>> Cells-based GUI projects look interesting to me. ?I think I should >>> probably learn how to use Cells (at some basic level) before trying to >>> dive into one of the GUI packages. ?Is there a Cells-based GUI package >>> that is currently preferred? >> >> Celtk is running fine here, also Cells-Gtk is still in use AFAIK. >> >>> In general, I learn best by first following a simple example, then >>> modifying it to do my bidding. ?Can someone show me how to get started? >> >> https://github.com/kennytilton/cells/wiki >> >>> I'm also wondering if someone can explain the difference between DEFMODEL >>> and DEFMD to me. >> >> defmodel is like defclass - with just a few more slot options to declare a cell. >> defmd is a convenience macro that helps in writing less boilerplate code: >> >> With defmodel a cellsified class might look like this: >> >> (DEFMODEL CAT (MODEL) >> ? ? ? ? ? ? ? ? ((NAME :INITFORM NIL :INITARG :NAME) >> ? ? ? ? ? ? ? ? ?(FUR-COLOR :INITFORM NIL :INITARG :FUR-COLOR) >> ? ? ? ? ? ? ? ? ?(TITLE :INITARG :TITLE :INITFORM >> ? ? ? ? ? ? ? ? ? ? ? ? (C? (UTILS-KT::CONC$ (^NAME) " with " (^FUR-COLOR) " fur.")))) >> ? ? ? ? ? ? ? ? (:DEFAULT-INITARGS >> ? ? ? ? ? ? ? ? ? ? ? :NAME (C-IN "") >> ? ? ? ? ? ? ? ? ? ? ? :FUR-COLOR (C-IN "black"))) >> >> the same could be written as: >> >> (defmd cat () >> ? ? ? ? ? ? ?name >> ? ? ? ? ? ? ?fur-color >> ? ? ? ? ? ? ?(title (c? (utils-kt::conc$ (^name) " with " (^fur-color) " fur."))) >> ? ? ? ? ? ? ?:name (c-in "") >> ? ? ? ? ? ? ?:fur-color (c-in "black")) >> >> ... the above is just part of the macroexpansion of this short form ... >> >> A very short demo with the above: >> >> CL-USER: (defvar *the-cat*) >> *THE-CAT* >> >> CL-USER: (setq *the-cat* (make-instance 'cat :name (c-in "Susi"))) >> CAT0 >> >> CL-USER: (title *the-cat*) >> "Susi with black fur." >> >>> >>> Thanks so much!, >>> Jim >> >> Hope that helps ;-) >> >> Cheers >> ? ?Frank >> >> >> _______________________________________________ >> cells-devel site list >> cells-devel at common-lisp.net >> http://common-lisp.net/mailman/listinfo/cells-devel > > _______________________________________________ > cells-devel site list > cells-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cells-devel -- I recommend "pleasant". ? - Elwood P. Dowd http://stuckonalgebra.com/