<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi all -<div><br></div><div>Today while looking for an old reference to Rosetta Smalltalk, I came across this site:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span><a href="http://rosettacode.org">http://rosettacode.org</a></div><div><br></div><div>In their own words, "<span class="Apple-style-span" style="font-family: -webkit-sans-serif; font-size: 13px; line-height: 19px; ">The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one language in learning another. &nbsp;Rosetta Code currently has 278 tasks, and covers 135 languages, though we do not have solutions to every task in every language."</span></div><div><font class="Apple-style-span" face="-webkit-sans-serif" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"><br></span></font></div><div><font class="Apple-style-span" face="-webkit-sans-serif" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: 19px;">It seemed to me that some of the Smalltalk examples are not as nice as they might be. &nbsp;For instance the very first thing I looked at was the Ackermann function which is written as a block...</span></font></div><div><font class="Apple-style-span" face="-webkit-sans-serif" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"><br></span></font></div><div><font class="Apple-style-span" face="-webkit-sans-serif" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"><pre class="smalltalk highlighted_source" style="font-family: monospace; padding-top: 1em; padding-right: 1em; padding-bottom: 1em; padding-left: 1em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(47, 111, 171); border-right-color: rgb(47, 111, 171); border-bottom-color: rgb(47, 111, 171); border-left-color: rgb(47, 111, 171); color: black; background-color: rgb(249, 249, 249); line-height: 1.1em; position: static; z-index: auto; ">|<span class="re3" style="background-color: rgb(255, 204, 204); ">ackermann</span>|<br><span class="re6">ackermann</span> <span class="sy0">:=</span> <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">[</span>&nbsp;:<span class="re5">n</span>&nbsp;:<span class="re5">m</span> |<br>  <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">(</span><span class="re5">n</span> <span class="sy0">=</span> <span class="re5">0</span><span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">)</span> ifTrue: <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">[</span> <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">(</span><span class="re5">m</span> + <span class="re5">1</span><span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">)</span> <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">]</span><br>          ifFalse: <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">[</span><br>           <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">(</span><span class="re5">m</span> <span class="sy0">=</span> <span class="re5">0</span><span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">)</span> ifTrue: <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">[</span> <span class="re5">ackermann</span> value: <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">(</span><span class="re5">n</span>-<span class="re5">1</span><span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">)</span> value: <span class="re5">1</span> <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">]</span><br>                   ifFalse: <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">[</span><br>                        <span class="re5">ackermann</span> value: <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">(</span><span class="re5">n</span>-<span class="re5">1</span><span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">)</span><br>                                  value: <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">(</span> <span class="re5">ackermann</span> value: <span class="re5">n</span><br>                                                     value: <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">(</span><span class="re5">m</span>-<span class="re5">1</span><span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">)</span> <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">)</span><br>                   <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">]</span><br>          <span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">]</span><br><span class="br0" style="font-weight: bold; color: rgb(0, 153, 0); ">]</span>.<br></pre></span></font></div><div><font class="Apple-style-span" face="-webkit-sans-serif" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: 19px;">To begin with, this is cluttered with value:value:; &nbsp;it includes redundant parentheses which don't belong in an illustration of the language; &nbsp;finally, it will not run in Smalltalks that do not allow recursive blocks. &nbsp;Seems to me it might be more illustrative as an Integer method that will run in any Smalltalk, that runs faster too, and looks cleaner to me...</span></font></div><div><font class="Apple-style-span" face="-webkit-sans-serif" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"><br></span></font></div><div><font class="Apple-style-span" face="-webkit-sans-serif" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"><div>&lt;Integer> ack: n &nbsp;"The first parameter m is the receiver, self, in this Ackermann method"</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>self = 0 ifTrue: [^ n+1].</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>self > 0 ifTrue:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>[n = 0 ifTrue: [^ self-1 ack: 1].</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> n > 0 ifTrue: [^ self-1 ack: (self ack: n-1)] ]</div><div><div>"</div><div>0 ack: 0 ==> 1</div><div>3 ack: 4 ==> 125</div><div>"</div></div><div><br></div><div>Anyway, I thought Smalltalk's representation on that site could use a little QA, and that folks on this list might have a good time playing TerseMan. &nbsp;I could imagine the Squeak solutions being an interesting area in our Wiki, both as a staging area for such a project, and as a possibly interesting collection of TerseMan discussions (terseness is great fun, but not always the ideal). &nbsp;A comment on the last line might point to our Wiki which might gain some new Squeak users, and would encourage checking with us before anyone overwrites our contributions.</div></span></font></div></body></html>