[Newbies] Re: Beginners Digest, Vol 42, Issue 11

Alan Turing aabbcbbaa at gmail.com
Fri Oct 30 18:29:22 UTC 2009


Than you very much for your suggests! :)



2009/10/30  <beginners-request at lists.squeakfoundation.org>:
> Send Beginners mailing list submissions to
>        beginners at lists.squeakfoundation.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://lists.squeakfoundation.org/mailman/listinfo/beginners
> or, via email, send a message with subject or body 'help' to
>        beginners-request at lists.squeakfoundation.org
>
> You can reach the person managing the list at
>        beginners-owner at lists.squeakfoundation.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Beginners digest..."
>
>
> Today's Topics:
>
>   1. hello (Alan Turing)
>   2. Re: hello (David Mitchell)
>   3. Drawing a line on a morph (Christine Wolfe)
>   4. Re: Closure support (Andy Burnett)
>   5. Re: Closure support (Randal L. Schwartz)
>   6. Re: hello (Alex Schenkman)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 30 Oct 2009 15:27:47 +0100
> From: Alan Turing <aabbcbbaa at gmail.com>
> Subject: [Newbies] hello
> To: beginners at lists.squeakfoundation.org
> Message-ID:
>        <36cb79140910300727y1ebc086eif99c67d1445837c7 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi,
>
> I am new in smalltalk and squeak.
> In this language what is the right way to learn smalltalk/squeak? I am
> reading a ebook of Ducasse "learn programming with robots" and it
> seems good for begin. Anyway, after this book I would like make
> something for manage networks and database; what resource may I use?
>
> thanks.
>
>
> max
>
>
> ------------------------------
>
> Message: 2
> Date: Fri, 30 Oct 2009 10:31:52 -0500
> From: David Mitchell <david.mitchell at gmail.com>
> Subject: Re: [Newbies] hello
> To: "A friendly place to get answers to even the most basic questions
>        about   Squeak." <beginners at lists.squeakfoundation.org>
> Message-ID:
>        <8bc830730910300831u60f087a7v179c3f766d5eeb02 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Max,
>
> Steph's book is a nice way to learn programming. I'm actually using his bots
> environment as part of a presentation I'm doing this coming Saturday at the
> Iowa Code Camp in Des Moines.
>
> Steph has a great list of free Smalltalk books on his site. On that is a
> little dated but is an excellent read is known as the NuBlue book by Mark
> Guzdial:
>
> http://www.amazon.com/Squeak-Open-Personal-Computing-Multimedia/dp/0130280917
>
> You can actually review a draft of the chapters of that book from Steph's
> site. There is one chapter in particular by Bijian Parsia, Lex Spoon (of
> Programming Scala fame), and Bolot Kerimbaev:
>
> http://coweb.cc.gatech.edu/squeakbook/uploads/parsia.pdf
>
> Good luck
>
> --David
> http://www.withaguide.com
>
>
>
> On Fri, Oct 30, 2009 at 9:27 AM, Alan Turing <aabbcbbaa at gmail.com> wrote:
>
>> Hi,
>>
>> I am new in smalltalk and squeak.
>> In this language what is the right way to learn smalltalk/squeak? I am
>> reading a ebook of Ducasse "learn programming with robots" and it
>> seems good for begin. Anyway, after this book I would like make
>> something for manage networks and database; what resource may I use?
>>
>> thanks.
>>
>>
>> max
>> _______________________________________________
>> 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/20091030/e2af5f3e/attachment-0001.htm
>
> ------------------------------
>
> Message: 3
> Date: Fri, 30 Oct 2009 11:52:26 -0400
> From: "Christine Wolfe" <cwdw01 at earthlink.net>
> Subject: [Newbies] Drawing a line on a morph
> To: <beginners at lists.squeakfoundation.org>
> Message-ID: <003c01ca5978$fa97cb40$efc761c0$@net>
> Content-Type: text/plain; charset="us-ascii"
>
> If anyone has followed the dice example in Chapter 11 of Squeak By Example
> you will recognize that I'm trying to build a variation of the dice.  The
> difference is that I am trying to draw figures on the faces instead of dots.
>
>
>
> What I am trying to do is have a group (array, set, collection?) of "faces"
> on a rectangle - sort of like a child's building block with an image on each
> of the faces. I want 1 face to be blank, one to have a line, one to have a
> diamond, and one to have a rectangle. In the dice example, they draw dots on
> the faces but I think I can use the same logic to draw lines on the faces.
>
>
>
> I've pasted what I tried to the end of this post but I'm open to other ways
> to do it.  I can't even get a simple line to draw on the face of the
> rectangle.  You can see that I tried to have the "face" methods send a pair
> of points that define the ends of the line and have drawLineOn draw a line
> between the points.  Any help or advice will be greatly appreciated.
>
>
>
> In the dice example they use:
>
>
>
> BorderedMorph subclass: #DieMorph
>
>                instanceVariableNames: 'faces dieValue isStopped'
>
>                classVariableNames: ''
>
>                poolDictionaries: ''
>
>                category: 'SBEexamples'
>
>
>
> and
>
>
>
> drawOn: aCanvas
>
> super drawOn: aCanvas.
>
> (self perform: ('face', dieValue asString) asSymbol)
>
> do: [:aPoint | self drawDotOn: aCanvas at: aPoint]
>
>
>
> and
>
>
>
> drawDotOn: aCanvas at: aPoint
>
> aCanvas
>
> fillOval: (Rectangle
>
> center: self position + (self extent * aPoint)
>
> extent: self extent / 6)
>
> color: Color black.
>
>
>
> and
>
>
>
> face1
>
> ^{0.5 at 0.5}
>
>
>
> And
>
>
>
> face2
>
> ^{0.25 at 0.25 . 0.75 at 0.75}
>
>
>
> I tried:
>
>
>
> BorderedMorph subclass: #MyMorph
>
>                instanceVariableNames: 'faces dieValue isStopped'
>
>                classVariableNames: ''
>
>                poolDictionaries: ''
>
>                category: 'SBEexamples'
>
>
>
> and
>
>
>
> drawOn: aCanvas
>
> super drawOn: aCanvas.
>
> (self perform: ('face', dieValue asString) asSymbol)
>
> do: [{:aPoint, anotherPoint} | self drawLineOn: aCanvas from: aPoint to:
> anotherPoint]
>
>
>
> and
>
>
>
> drawLineOn: aCanvas from: aPoint to anotherPoint
>
> aCanvas
>
> line: aPoint to: anotherPoint width: 2 color: Color black.
>
>
>
> and
>
>
>
> face1
>
> ^{{2 at 2, 2 at 10}, {2 at 2, 10 at 2}, {10 at 10, 2 at 10}, {10 at 10, 10 at 2}}
>
>
>
> And
>
>
>
> face2
>
> ^{{5 at 5, 5 at 7}, {5 at 2, 7 at 2}, {7 at 7, 5 at 7}, {7 at 7, 7 at 5}}
>
>
>
>
>
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20091030/3251c477/attachment-0001.htm
>
> ------------------------------
>
> Message: 4
> Date: Fri, 30 Oct 2009 11:59:16 -0400
> From: Andy Burnett <andy.burnett at knowinnovation.com>
> Subject: Re: [Newbies] Closure support
> To: beginners at lists.squeakfoundation.org
> Message-ID:
>        <8d0323b90910300859j7bd95541g9de23fca6da650f2 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Randal said...
>
> <<With classic smalltalk 80 and Squeak:
>
> a := (1 to: 10) do: [:n | [n]].
> b := a collect: [:each | each value].
> b will have something like #(10 10 10 10 ...).
>
> The problem is that the :n in each block ([n]) is shared as one variable.
> In a true closure, which modern Squeak and Pharo provide, we get the proper
> #(1 2 3 4 ... 10).  That's because each apperance of "n" is "closed" with
> respect to the newly created block.>>
>
> Thanks for explaining the difference between blocks and closures. I think I
> new understand that.  And, your example raised a new question for me.
>
> What does the inner 'block' in [:n | [n]] actually do?
>
> Out of curiosity I tried changing it to [:n | [n*10]], expecting the numbers
> to be ten times bigger, but they were stil 1, 2, 3...  I also tried removing
> the whole block, and b still evaluated to the same values.
>
> Cheers
> Andy
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20091030/cf1b528c/attachment-0001.htm
>
> ------------------------------
>
> Message: 5
> Date: Fri, 30 Oct 2009 09:10:46 -0700
> From: merlyn at stonehenge.com (Randal L. Schwartz)
> Subject: Re: [Newbies] Closure support
> To: Andy Burnett <andy.burnett at knowinnovation.com>
> Cc: beginners at lists.squeakfoundation.org
> Message-ID: <86k4ycj20p.fsf at blue.stonehenge.com>
> Content-Type: text/plain; charset=us-ascii
>
>>>>>> "Andy" == Andy Burnett <andy.burnett at knowinnovation.com> writes:
>
> Andy> Randal said...
> Andy> <<With classic smalltalk 80 and Squeak:
>
> Andy> a := (1 to: 10) do: [:n | [n]].
> Andy> b := a collect: [:each | each value].
> Andy> b will have something like #(10 10 10 10 ...).
>
> Argh.  That should have been collect: not do:
>
> Andy> Out of curiosity I tried changing it to [:n | [n*10]], expecting the numbers
> Andy> to be ten times bigger, but they were stil 1, 2, 3...  I also tried removing
> Andy> the whole block, and b still evaluated to the same values.
>
> Works better with collect. :)
>
> a := (1 to: 10) collect: [:n | [n * 10]].
> b := a collect: [:each | each value]
>
> b is now #(10 20 30 40 50 60 70 80 90 100) in a closure world.  In
> non-closure, it would have been 100, 100, 100...
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
> See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
>
>
> ------------------------------
>
> Message: 6
> Date: Fri, 30 Oct 2009 17:24:57 +0100
> From: Alex Schenkman <alex at schenkman.info>
> Subject: Re: [Newbies] hello
> To: "A friendly place to get answers to even the most basic questions
>        about   Squeak." <beginners at lists.squeakfoundation.org>
> Message-ID:
>        <67c0a2ee0910300924x7b4d0654l60ce676354a7208d at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Squeak by example <http://squeakbyexample.org/> or Pharo by
> example<http://pharobyexample.org/>,
> both by Ducasse, are great books.
>
>
> On Fri, Oct 30, 2009 at 15:27, Alan Turing <aabbcbbaa at gmail.com> wrote:
>
>> Hi,
>>
>> I am new in smalltalk and squeak.
>> In this language what is the right way to learn smalltalk/squeak? I am
>> reading a ebook of Ducasse "learn programming with robots" and it
>> seems good for begin. Anyway, after this book I would like make
>> something for manage networks and database; what resource may I use?
>>
>> thanks.
>>
>>
>> max
>> _______________________________________________
>> 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/20091030/4a64f0bb/attachment.htm
>
> ------------------------------
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
> End of Beginners Digest, Vol 42, Issue 11
> *****************************************
>


More information about the Beginners mailing list