[Newbies] Teaching Smalltalk

David Mitchell david.mitchell at gmail.com
Tue May 4 03:30:55 UTC 2010


Bummed that Why Smalltalk is gone.

Here is my crack at translating. Wouldn't say this is idiomatic Smalltalk
(transliterated C never will be). But it ran in the transcript.

Tried to only use ANSI Smalltalk:

| count doors |
count := 10.
"Initialize the array of doors to 0 (closed)"
doors := (Array new: count) atAllPut:  false.

"Process the doors"
1 to: count do:
    [ :pass |
    pass to: count by: pass do:
        [ :door |
        doors
            at: door
            put: (doors at: door) not ] ].

"Print out the results"
1 to: count do:
    [ :n |
    Transcript
        show: 'door #', n, ' is ';
        show: ((doors at: door) ifTrue: [#open] ifFalse: [#closed]);
        cr]


On Mon, May 3, 2010 at 7:58 AM, David Mitchell <david.mitchell at gmail.com>wrote:

> For why smalltalk, you might check whysmalltalk.org.
>
> I wrote a little piece on what makes Squeak special on my blog last year:
> http://www.withaguide.com/2009/04/what-makes-squeak-special.html
>
> Don't have time this AM to rewrite the C code, but will look tonight. You
> might want to look at the first chapter of "A Taste of Smalltalk" which
> rewrites a simple Pascal program in Pascal style code with Smalltalk.
>
>
> On Mon, May 3, 2010 at 7:20 AM, Samuel Williams <
> space.ship.traveller at gmail.com> wrote:
>
>> Dear Friends,
>>
>> I'm looking for some help from the Smalltalk community. I hope this is the
>> right place to ask for information.
>>
>> I'm putting together a website aimed at high school students and teachers,
>> and would like to make sure the following page is as good as possible:
>>
>> http://programming.dojo.net.nz/languages/smalltalk/index
>>
>> In particular, "Why would I learn this language?" section needs to have a
>> few paragraphs. I don't use Smalltalk so I hoped that you could provide the
>> main reasons why Smalltalk is a language someone would want to learn about.
>>
>> It would also be great if someone could rewrite the Smalltalk source code
>> example so that it is as close as possible to the C implementation:
>>
>> http://programming.dojo.net.nz/languages/c/index
>>
>> I understand that Smalltalk is very different from C, and uses different
>> paradigms, so it doesn't have to be identical, however it would be great if
>> it worked in generally the same way. It would be great if you could include
>> comments explaining how it works and what is happening (like the C example).
>>
>> Any other suggestions or ideas for the Smalltalk page would be fantastic,
>> and any suggestions to other pages in general is also very helpful.
>>
>> http://programming.dojo.net.nz/
>>
>> Kind regards,
>> Samuel
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20100503/10f8f0b5/attachment.htm


More information about the Beginners mailing list