[squeak-dev] Re: Smalltalk and functional programming

Stéphane Rollandin lecteur at zogotounga.net
Mon Aug 30 08:31:07 UTC 2010


Le 24/08/2010 20:07, Chris Cunnington a écrit :
> Perhaps somebody would be willing to show a piece of code written in a
> functional style?
>
> This was presented but then quickly dismissed: Smalltalk at: #square
> put: [: x| x * x ]
>
>
> Chris

| f g h |

f := Lambda m position: 100 @ 100.
g := Lambda m color: Color red.
h := Lambda m openInWorld.

h <~ Morph new. "shows a Morph"
h <= g <~ Morph new. "shows a red Morph".
h <= g <= f <~ Morph new. "shows a red Morph at 100 @ 100".


... more about this at: 
http://www.zogotounga.net/comp/squeak/functionaltalk.htm


Stef





More information about the Squeak-dev mailing list