[ANN] LambdaMessageSend on SqueakMap
Stéphane Rollandin
lecteur at zogotounga.net
Sat May 13 12:51:24 UTC 2006
hello list,
LambdaMessageSend, aka FunctionalTalk, implements a specialized
MessageSend subclass and an associated API for functional programming in
Squeak.
you can do things like:
| x y f g j |
x _ Lambda x.
y _ Lambda y.
f _ ((x*x) + (y*y)) sqrt.
self assert: f printString = '(((<x> * <x>) + (<y> * <y>)) sqrt)'.
self assert: {3 . 4} ~~> f = 5.
g := ('y' -> 0) ~>> f.
self assert: g printString = '(((<x> * <x>) + 0) sqrt)' .
self assert: 3 ~> g = 3.
j := ('y' -> (Lambda z1 + Lambda z2)) ~>> f.
self assert: j printString = '(((<x> * <x>) + ((<z1> + <z2>) * (<z1> +
<z2>))) sqrt)' .
self assert: {3 . 2 . 2} ~~> j = 5.
see the test cases in FunctionalTalkTest for comprehensive documentation.
I would be interested in feedback and criticism from languages gurus.
the idea here is to define a MessageSend those receiver, selector and
arguments can themselves be MessageSend. It seems to me that we get this
way a clean lambda calculus framework but of course I may be wrong.
what do you think ?
Stef
More information about the Squeak-dev
mailing list
|