Hi Johan, That is nice indeed. It is good to see that you have fun learning Pharo Smalltalk. Can you do it ? Of course, you can do what you want, Pharo Smalltalk is a highly flexible environment. Key to its simplicity are its ultra simple syntax which hits a magical optimum between simplicity and capability (full syntax on a postcard). With just messages and block, you can express almost anything (one limitation is that there are no macros). Part of that is (for me at least), left to right evaluation/reading - trying to change that 'hurts'. Binary operators are useful and even necessary, but the problem with totally new uses is that readers won't understand them. Being a bit more verbose helps, in my opinion. You might also be interested in the following: Lambda Calculus in Pharo Yes, the Y Combinator is useful in normal programs https://medium.com/concerning-pharo/lambda-calculus-in-pharo-a4a571869594 Regards, Sven
On 23 Oct 2019, at 15:12, main <johan_forsberg_86@hotmail.com> wrote:
Hi again!
Just putting it out there for anyone interested.
What I did was define the following in Object:
|> aBlock ^ [ :x | x => self => aBlock ]
and also:
=> msg ^ msg value: self
This enabled me to compose like this (I know I probably violate every rule in the book, whatever ):
f := [ :x | x + 100 ]. g := [ :x | x + 20 ]. h := [ :x | x + 3 ].
0 => (f |> g |> h). 123
Also tried using ~:
0 => (f ~ g ~ h). 123
It's just a matter of taste I guess, but for me it warms my heart
-- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html