[cells-devel] openair progress

Ken Tilton kennytilton at optonline.net
Fri Apr 4 13:46:51 UTC 2008


Andy Chambers wrote:
> I got the js-escape working better last night and went on to try and
> fill out the apropos demo but ran into
> some difficulties.
> 
> I may need to rethink the macrology because when I put the following
> into the web-apropos model, I just got
> a list of progvs.
> 
> (mk-div ()
>    (mk-ul ()
>       (loop for func in (apropos-list "prog")
>          collect (mk-li ()
>                       (mk-text func)))))

Don't feel bad, that is frequent "gotcha" even for loop veterans (and it 
is loop, not macrology, slowing you down (somewhat abbreviated):

(loop for x in (apropos-list "prog")
       collect (let ((x x)) ;; shadow the "x" abused by loop
                  (mk-text x)))

> Also, only changes to attributes are getting propagated to the updates
> slot, not changes to kids.

Hey, just send me the latest code and I'll figure it out. If you do not 
have aserve working, we can probably figure it out with a test harness 
that writes updates to the console.

I would make a top-level class:

(defmd xh-driver ()
    search-string
    (exported-only
    ...other input slots and really any slot you need to make this go...
    (xml (driven-xml)))

(defun driven-xml
    (mk-page
       (loop for match in (apropos-list (search-string (u^ xh-driver)))
             when (or (exportedp match)
                      (not (exported-only (u^ xh-driver))))
             collect [xml for this symbol])))

Then (just typed in, polish required):

(defun test-xh ()
    (let ((d (make-instance 'xh-driver
                 :search-string "prog" ;; no changes intended
                 :exported-only (c-in nil)))) ;; changes intended
       (with-oa-updates-to-stream t ;; or "test.txt"
          (loop repeat 2
             do (setf (exported-only d) (not (exported-only d))))))

with-oa-updates-to-stream is left as an exercise. It needs OA to always 
work by writing to some stream (*browser*? *xml-updates*?) and then you 
just bind that to t or some *sys-something* or an open file stream.

I toggled both ways to test both /starting/ with nil and /changing/ to nil.


> 
> In short, I'm still plugging away at this but I might be further away
> from producing something
> useful than it has seemed so far.  Sorry if I've got people's hopes
> up.  Its just the typical time estimates of
> an inexperienced programmer.

haha, I think you are closer than you realize. Just send up flares early 
and often.

> 
> I'm going to go back to celtk and try to understand the way it does
> things a bit better and see if there's
> anything fundamental I've missed.  I should maybe code the apropos
> thing in celtk to check how the user
> code should look and make similar sort of code work for the web.
> 
> Here's a quick question.  If you want to make the kids of a mk-stack
> dependant on some other field in celtk,
> do you have to explicitly (make-instance 'stack :kids (c? ...) or
> should you still be able to use (mk-stack () ...)

mk-stack by default wraps what follows in a recalculating rule:

(defmacro def-mk-inline (name (unlabelled labelled))
   `(defmacro ,name ((&rest initargs) &rest kids)
      (if (evenp (length initargs))
          `(make-instance ',',unlabelled
             :fm-parent *parent*
             , at initargs
             :kids (c? (the-kids , at kids)))
        `(make-instance ',',labelled
           :fm-parent *parent*
           :text ,(car initargs)
           ,@(cdr initargs)
           :kids (c? (the-kids , at kids))))))

(def-mk-inline mk-row (frame-row labelframe-row))
(def-mk-inline mk-stack (frame-stack labelframe-stack))

kt




More information about the cells-devel mailing list