From: Ken Tilton
Subject: ECLM 2008
Date: 
Message-ID: <481945f0$0$25031$607ed4bc@cv.net>
I was inspired by my recent dust-up with Pascal C to take a new tack on 
Cells proselytization, ironically in line with what I already meant to 
be the theme of my talk until someone said I should talk about Cells 
(twist my arm!). It turns out I should have done both.

The idea behind Cells (spreadsheet for CLOS instances) is so simple no 
one understands what one would do with it unless they already are. So I 
should have just talked about how they serve some larger purpose, 
application or library. I took a swipe at that in what is referred to as 
"PDF #1" in my listing here: http://www.weitz.de/eclm2008/

PDF #2 might be fun for folks who already understand the power of this 
type of library as a class and are curious about functional specifics of 
this instance.

The two Google videos are a short opening rant and then a longer piece 
about RDF, Cello, the Lisp Way, four girls in bikinis, and a surprising 
amount on driving.

Meanwhile, I have been in a funk ever since Pascal failed to take up my 
challenge and support his claim that Cells was an untrustworthy train 
wreck of code -- I was looking forward to some serious fun, especially 
because the code /is/ terrifying. But I /think/ that is because I just 
leave in place all the debugging stuff (disabled, of course) and because 
there are a lot of sanity checks in there. I have taken those out before 
only to put them back in when the next hard bug came up so I just leave 
them in there, it is not as if I ever look at that code. Anyway, it 
looks like I will have to play the part of PC if I want to have a brawl, 
so... this code is horrible!:

(defun calculate-and-set (c)
   (flet ((body ()
            (when (c-stopped)
              (princ #\.)
              (return-from calculate-and-set))

            #-its-alive!
            (bwhen (x (find c *call-stack*)) ;; circularity
              (unless nil ;; *stop*
                (let ()
                  (inspect c)
                  (trc "calculating cell:" c (cr-code c))
                  (trc "appears-in-call-stack (newest first): "
                        (length *call-stack*))
                  (loop for caller in (copy-list *call-stack*)
                      for n below (length *call-stack*)
                      do (trc "caller> " caller #+shhh (cr-code caller))
                        when (eq caller c) do (loop-finish))))
              (setf *stop* t)
              (c-break ;; break is problem when testing cells on some CLs
               "cell ~a midst askers (see above)" c)
              (error "see listener for cell rule cycle diagnotics"))

            (multiple-value-bind (raw-value propagation-code)
                (calculate-and-link c)

              (when (and *c-debug* (typep raw-value 'cell))
                (c-break "new value for cell ~s is itself a cell: ~s. 
probably nested (c? ... (c? ))"
                  c raw-value))

              (unless (c-optimized-away-p c)
                ; this check for optimized-away-p arose because a rule 
using without-c-dependency
                ; can be re-entered unnoticed since that clears 
*call-stack*. If re-entered, a subsequent
                ; re-exit will be of an optimized away cell, which we 
need not sv-assume on... a better
                ; fix might be a less cutesy way of doing 
without-c-dependency, and I think anyway
                ; it would be good to lose the re-entrance.
                (md-slot-value-assume c raw-value propagation-code)))))
     (if (trcp c) ;; *dbg*
         (wtrc (0 100 "calcnset" c) (body))
       (body))))

Nonsense! Here is the same thing without comments or debugging/defensive 
stuff!:

  (defun calculate-and-set (c)
    (multiple-value-bind (raw-value propagation-code)
        (calculate-and-link c)
      (unless (c-optimized-away-p c)
        (md-slot-value-assume c raw-value propagation-code))))

Wow. Too bad I did not abbreviate:

  (defun calc-n-set (c)
    (multiple-value-bind (v prop)
        (calc-n-link c)
      (unless (c-optmzd? c)
        (md-slot-v-assume c v prop))))

Damn.

Of course the run-time diagnostic on cycles is a courtesy to Cells users 
(including moiself) so it should stay, but I could throw an error 
condition and let /that/ offer the debug diagnostics, keeping the code 
itself clean for when the white glove crowd comes snooping.

But now it is time for Algebra.

kenny

-- 
http://smuglispweeny.blogspot.com/
http://www.theoryyalgebra.com/

"I've never read the rulebook. My job is to catch the ball."
   -- Catcher Josh Bard after making a great catch on a foul ball
and then sliding into the dugout, which by the rules allowed the
runners to advance one base costing his pitcher a possible shutout
because there was a runner on third base.

"My sig is longer than most of my articles."
   -- Kenny Tilton
From: Ken Tilton
Subject: Re: ECLM 2008
Date: 
Message-ID: <48194937$0$11631$607ed4bc@cv.net>
Ken Tilton wrote:
> But now it is time for Algebra.

Speaking of which, I started a Google group to support the Algebra 
software. I am probably a month away from shipping even an alpha, but 
interested parties should email me if they would like to play with the 
beast. (It will be a restricted group until the code, um, works.)

kenny

-- 
http://smuglispweeny.blogspot.com/
http://www.theoryyalgebra.com/

"I've never read the rulebook. My job is to catch the ball."
   -- Catcher Josh Bard after making a great catch on a foul ball
and then sliding into the dugout, which by the rules allowed the
runners to advance one base costing his pitcher a possible shutout
because there was a runner on third base.

"My sig is longer than most of my articles."
   -- Kenny Tilton