Oct. 23, 2019
12:20 p.m.
It is like Object>>in: aBlock no? On Wed, 23 Oct 2019, 10:27 Kasper Osterbye, <kasper.osterbye@gmail.com> wrote:
You can define a method "=>" in Object as:
=> aBlock ^ aBlock value: self
That would allow you to write expressions like this: 7 => [ :x | x+3 ] => [ :x| x*3 ],
if you further define "=>" in Array as:
=> aBlock ^ aBlock valueWithArguments: self
you are able to write your example: (([ :f :g | [ :x | f (g x) ] ]) [:x | x + 1] [:x | x - 1]) 5
as:
5 => ({ [:x | x + 1]. [:x | x - 1]} => [ :f :g | [ :x | x => g =>f ] ]).
It reads from left to right where yours is the usual Arabic (right to left) favoured in functional style.