From: bradb on
Ah, I wasn't aware you could get a tarball like that. Which is funny
because I've used that view cvs interface a bit before, I guess you
very quickly filter stuff out :)

Brad

From: Tayssir John Gabbour on
bradb wrote:
> No luck with the demos, sorry. Now the function CV is undefined.

Does anyone else have problems with DEF-C-OUTPUT? Its OLD-VALUE always
reporting NIL to me... but that doesn't make sense; I expect it to hold
whatever the last slot value was.

Adapted from cells-test/hello-world.test (I tried both latest CVS Cells
and the tarball, with SBCL PPC Darwin 0.9.9):


(use-package :cells)
(use-package :utils-kt)

(defmodel computer ()
((happen :cell :ephemeral :initform (c-in nil) :accessor happen)
(location :cell t
:initform (c? (case (^happen)
(:leave :away)
(:arrive :at-home)
(t .cache))) ;; ie, unchanged
:accessor location)
(response :cell :ephemeral
:initform nil
:initarg :response
:accessor response)))

(macrolet ((fmt (name)
`(format t
"~%~A: ~15A (previously ~:[an unbound ~A~;~A~])"
,name new-value old-value-boundp old-value)))
(def-c-output response () (fmt "response"))
(def-c-output happen () (fmt "happen "))
(def-c-output location () (fmt "location")))

(defun hello-world ()
(let ((dell (make-be 'computer
:response (c? (bwhen (h (happen self))
(if (eql (^location) :at-home)
(case h
(:knock-knock "who's
there?")
(:world "hello, world."))
"<silence>"))))))
(dotimes (n 2)
(setf (happen dell) :knock-knock))
(setf (happen dell) :arrive)
(setf (happen dell) :knock-knock)
(setf (happen dell) :world)
(values)))



CL-USER> (hello-world)

happen : NIL (previously an unbound NIL)
location: NIL (previously NIL)
response: NIL (previously NIL)
happen : KNOCK-KNOCK (previously NIL)
response: <silence> (previously NIL)
happen : KNOCK-KNOCK (previously NIL)
response: <silence> (previously NIL)
happen : ARRIVE (previously NIL)
location: AT-HOME (previously NIL)
happen : KNOCK-KNOCK (previously NIL)
response: who's there? (previously NIL)
happen : WORLD (previously NIL)
response: hello, world. (previously NIL)
; No value

From: Ken Tilton on
Tayssir John Gabbour wrote:
> bradb wrote:
>
>>No luck with the demos, sorry. Now the function CV is undefined.
>
>
> Does anyone else have problems with DEF-C-OUTPUT? Its OLD-VALUE always
> reporting NIL to me...

That just happens to be the case, partly because it is a silly example,
mostly because most of the slots are ephemeral, which are actually not
the norm in real world programming.

The silly example has the location start out as neither :at-home nor
:away, but instead nil. Hell, I'll go so far as to call that a bug since
that is not a sensible location. I should probably have it be :at-home
if nothing has yet transpired, but the example wants the system to be
away for the first few knocks. And so it goes. :)

if you add (setf (happen dell) :leave) you should see the location
output go from :at-home to :away.

As for ephemerals, oddly enough, Cells being good at modelling
long-lived state created a problem: how does one model events, which
happen but then are no more?

Ask on the Cells list and I will expand further on why events must be
handled differently, but ephemerals are how I hacked events into the
paradigm: slots specified as ephemeral revert to nil immediately after
propagating any non-nil value they assume, but not as a state change
seen by the model.

> but that doesn't make sense; I expect it to hold
> whatever the last slot value was.

Yep. Ephemerals are the oddball in this regard.

ken

>
> Adapted from cells-test/hello-world.test (I tried both latest CVS Cells
> and the tarball, with SBCL PPC Darwin 0.9.9):
>
>
> (use-package :cells)
> (use-package :utils-kt)
>
> (defmodel computer ()
> ((happen :cell :ephemeral :initform (c-in nil) :accessor happen)
> (location :cell t
> :initform (c? (case (^happen)
> (:leave :away)
> (:arrive :at-home)
> (t .cache))) ;; ie, unchanged
> :accessor location)
> (response :cell :ephemeral
> :initform nil
> :initarg :response
> :accessor response)))
>
> (macrolet ((fmt (name)
> `(format t
> "~%~A: ~15A (previously ~:[an unbound ~A~;~A~])"
> ,name new-value old-value-boundp old-value)))
> (def-c-output response () (fmt "response"))
> (def-c-output happen () (fmt "happen "))
> (def-c-output location () (fmt "location")))
>
> (defun hello-world ()
> (let ((dell (make-be 'computer
> :response (c? (bwhen (h (happen self))
> (if (eql (^location) :at-home)
> (case h
> (:knock-knock "who's
> there?")
> (:world "hello, world."))
> "<silence>"))))))
> (dotimes (n 2)
> (setf (happen dell) :knock-knock))
> (setf (happen dell) :arrive)
> (setf (happen dell) :knock-knock)
> (setf (happen dell) :world)
> (values)))
>
>
>
> CL-USER> (hello-world)
>
> happen : NIL (previously an unbound NIL)
> location: NIL (previously NIL)
> response: NIL (previously NIL)
> happen : KNOCK-KNOCK (previously NIL)
> response: <silence> (previously NIL)
> happen : KNOCK-KNOCK (previously NIL)
> response: <silence> (previously NIL)
> happen : ARRIVE (previously NIL)
> location: AT-HOME (previously NIL)
> happen : KNOCK-KNOCK (previously NIL)
> response: who's there? (previously NIL)
> happen : WORLD (previously NIL)
> response: hello, world. (previously NIL)
> ; No value
>
From: Frank Buss on
Ken Tilton wrote:

> Actually, I think c-l.net has the advantage over SourceForge here with
> nightly tarballs, so no one has to study the CVS /language/ just to get
> a little source.

SourceForge has nightly tarballs, too:

http://sourceforge.net/docs/E04/#nightly_tarballs

But it is different from c-l.net: It is a backup of the repository itself,
with all versions included. The same is possible with rsync read-only
access to the subversion repository.

But I don't see the advantage to download the head revision of all files in
CVS or SVN. If you are a developer and you want the latest source, use
checkout and then only bandwith saving updates. If you can't install a SVN
or CVS client, you are not a developer :-)
If you are a more normal user, then use official releases, only.

> Of course if you want to /track/ an active project one, well, I use
> TortoiseCVS so I /still/ do not need to learn CVS.

There is not much to learn for CVS or SVN, if you just want to track an
active project: an initial checkout (e.g. "svn co
https://svn.sourceforge.net/svnroot/lispbuilder lispbuilder" for the Common
Lisp Application Builder project at http://sf.net/projects/lispbuilder )
and a "svn up" (started in the project directory, no other options are
needed) everytime you want to be up-to-date is sufficient. Same with cvs,
only the path for the "co" command is different.

--
Frank Buss, fb(a)frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Tayssir John Gabbour on
Ken Tilton wrote:
> Tayssir John Gabbour wrote:
> > Does anyone else have problems with DEF-C-OUTPUT? Its OLD-VALUE always
> > reporting NIL to me...
>
> That just happens to be the case, partly because it is a silly example,
> mostly because most of the slots are ephemeral, which are actually not
> the norm in real world programming.

Aaah, yes that makes sense. My understanding is that with discrete
processes, we basically have a choice between cells being T or
:ephemeral ("states" and "events").

And :delta seems to be absent from your sourcetree, which makes sense
too.

Do you think it would be an improvement to have :cell T by default, and
if you want to cause an event, you'd do something other than setting
the slot-value? Like:
(setf (happens obj) :new-state) ;stays :new-state until changed
(eventf (happens obj) :new-event) ;reverts to initform immediately


Incidentally, if anyone could clarify a couple quick questions I'd be
grateful:

* So, cells only update other cells in their own object instance (not
even cells allocated as :class)? Which means a cell in one object has
to explicitly set another object's c-in cell?

* What other notable vars are there, like .cache and the ^slotnames?


Thanks,
Tayssir

First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11 12
Prev: cosx - sinx + 3x2
Next: the Modernization of Emacs