[cells-devel] How to get started?

Frank Goenninger frgo at me.com
Tue Apr 17 18:12:56 UTC 2012


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





More information about the cells-devel mailing list