[squeak-dev] Ulam spiral

H. Hirzel hannes.hirzel at gmail.com
Thu Dec 6 23:03:08 UTC 2012


I propose to add something like the following to the 'welcome workspace'.

 At the bottom, 'call to action  :-)  ,

cf Squeak web site discussion thread.

--Hannes
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

The desktop background shows an prime spiral. Natural numbers are
arranged in a spiral in a rectangular grid. The 1 is at the center.
Primes are marked with a dot.

To see how this is done in Squeak Smalltalk
a) select the following code,
b) bring up the context menu and
c) choose 'do it'.

   Display restoreAfter: [
                size := 400 squared.
                primes := (Integer primesUpTo: size) asSet.
                step := 1.
                length := 1.
                pen := Pen new turn: 90.
                [step < size] whileTrue: [
                        2 timesRepeat: [
                                length timesRepeat: [
                                        pen fillColor: ((primes includes: step)
                                                ifTrue: [Color black]
                                                ifFalse: [Color white]).
                                        pen go: 1.
                                        step := step + 1].
                                pen turn: -90].
                        length := length + 1]].

Ref:  http://en.wikipedia.org/wiki/Ulam_spiral

On 12/5/12, Frank Shearar <frank.shearar at gmail.com> wrote:
> On 12 October 2012 12:48, H. Hirzel <hannes.hirzel at gmail.com> wrote:
>> So the question is, do we get the Ulam spiral creation code snippet
>> included in Squeak 4.4?
>
> You ask 4.4's release manager, who says "yes! and I'd like some
> covering text too please!"
>
> frank
>
>> --Hannes
>>
>> On 10/3/12, Jecel Assumpcao Jr. <jecel at merlintec.com> wrote:
>>> Hannes. Hirzel wrote on Wed, 3 Oct 2012 14:45:45 +0200
>>>> Things which it illustrates are
>>>> 1) The compactness of the Smalltalk language
>>>> 2) How to modify code in a Workspace and execute it with 'do it'.
>>>> 3) The fact that you do not need to have 'deep' knowledge of Smalltalk
>>>> in order to adapt a piece of code.
>>>> 4) It is like a 'poem'. A short self contained nice piece of code.
>>>
>>> 5) Code can be executed directly in the mail window. Oh wait, that is
>>> just me - the last Celeste user ;-)
>>>
>>> -- Jecel
>>>
>>>
>>>
>>
>
>


More information about the Squeak-dev mailing list