<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On 03.05.2010, at 20:30, David Mitchell wrote:</div><blockquote type="cite">Bummed that Why Smalltalk is gone.<br></blockquote><div><br></div><div>Yeah. It's still in the archive though:</div><div><br></div><div><a href="http://web.archive.org/web/*/whysmalltalk.com">http://web.archive.org/web/*/whysmalltalk.com</a></div><br><blockquote type="cite">Here is my crack at translating. Wouldn't say this is idiomatic Smalltalk (transliterated C never will be). But it ran in the transcript.<br><br>Tried to only use ANSI Smalltalk:<br>
<br>| count doors |<br>count := 10.<br>"Initialize the array of doors to 0 (closed)"<br>doors := (Array new: count) atAllPut:&nbsp; false.<br><br>"Process the doors"<br>1 to: count do: <br>&nbsp;&nbsp;&nbsp; [ :pass |<br>
&nbsp;&nbsp;&nbsp; pass to: count by: pass do: <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [ :door |<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; doors <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; at: door <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; put: (doors at: door) not ] ].<br><br>"Print out the results"<br>1 to: count do: <br>&nbsp;&nbsp;&nbsp; [ :n |<br>
&nbsp;&nbsp;&nbsp; Transcript <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; show: 'door #', n, ' is ';<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; show: ((doors at: door) ifTrue: [#open] ifFalse: [#closed]);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cr]<br><br></blockquote><br></div><div>This looks a lot like</div><div><span class="Apple-tab-span" style="white-space:pre">        </span><a href="http://programming.dojo.net.nz/languages/smalltalk/index">http://programming.dojo.net.nz/languages/smalltalk/index</a></div><div>(although that code doesn't even run - could someone fix?)</div><div><br></div><div>How about this one - demonstrates better what Squeak provides:</div><div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>| doors |</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>doors := Array new: 100 withAll: false.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1 to: doors size do: [:pass |</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>doors := doors collectWithIndex: [ :isOpen :door |</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>(door isDivisibleBy: pass) xor: isOpen]].</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>^ (1 to: doors size) select: [:door | doors at: door]</div><div><br></div><div><br></div></div><div>
<span class="Apple-style-span" style="font-size: 12px; "><div style="font-family: Helvetica; "><span class="Apple-style-span" style="font-family: Helvetica; ">- Bert -</span></div><br class="Apple-interchange-newline"></span>
</div>
<br></body></html>