22 Dec 1999 14:02
RE: A y2k countdown clock
<Torsten.Bergmann <at> phaidros.com>
1999-12-22 13:02:52 GMT
1999-12-22 13:02:52 GMT
------_=_NextPart_000_01BF4C7C.DB7030A0 Content-Type: text/plain; charset="windows-1252" If you want to reuse Scott's Counter after the Millenium you can use the following change set. It's the same morph displaying the 'Seconds since Y2k' with the negated value. Very interesting that I did this changeset on the 1. Jan. 2000 ;) Merry Christmas and a Happy Millenium Torsten -----Original Message----- From: Scott Wallace [mailto:Scott.Wallace <at> disney.com] Sent: Dienstag, 21. Dezember 1999 22:43 To: squeak <at> cs.uiuc.edu Subject: A y2k countdown clock Just what you've always needed. -- Scott ------_=_NextPart_000_01BF4C7C.DB7030A0 Content-Type: text/plain; name="y2kCounter-tb.1Janu133pm.cs" ; x-mac-type="65417070" ; x-mac-creator="43534F6D" Content-Disposition: attachment; filename="y2kCounter-tb.1Janu133pm.cs" Content-Transfer-Encoding: imap_stub(Continue reading)
I am running Squeak under win98.
I included the Debug.log as an attachment.
I didn't find the version number of the VM but it is exactly 319,488 Bytes
and
seems to be created Friday the 8th of October (just what windows tells me).
Compared to Dan and the others from the LRG days were all newbies at this!
I still think there's a good deal of room for making your code more
Smalltalk-like. This is no end in itself; it will also become much shorter
and clearer. In particular, you can exploit the power of the Collection
classes; using loops instead of the Collection protocol is a common symptom
of someone coming from traditional languages.
First of all, if I understand it right, you are doing something similar to a
breadth-first tree traversal, more or less? Here's a standard solution to
b-t traversal, thanks to Kent Beck :) See how short it is thanks to the
Collection protocols:
Node>>levelOrderDo: aBlock
| queue current |
queue := OrderedCollection with: self.
[queue isEmpty] whileFalse: [
current := queue removeLast.
aBlock value: current.
queue addAllFirst: current children]
(The rest is off the top of my head since to run the code I would need more
than this snippet. Ie. it's probably buggy.) The main loop would become:
tempRefs keysAndValuesDo: [ :refKey :refDeps | "gives you the value too"
refQue := refQue, refDeps. "merges (most) whole collections for
you"
but it seems
reasonable implementation.
Thank you.
RSS Feed