On 2012-12-07, at 00:03, "H. Hirzel" hannes.hirzel@gmail.com wrote:
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]].
This version would be even less complex and one line shorter. But maybe a bit too sneaky? OTOH it demos fractional arithmetic, not a bad idea either:
Display restoreAfter: [ size := 400 squared. primes := (Integer primesUpTo: size) asSet. step := 1. length := 1. pen := Pen new turn: 90. [step < size] whileTrue: [ 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/2)]].
- Bert -