On a similar line - Iâve often noticed that an interesting block pattern in Smalltalk which is overlooked in other languages is how we handle errors through them. We often donât throw exceptions but instead pass a useful block (and often 2) for what to do instead. at:ifAbsent: comes to mind or at:ifPreset:ifAbsent: leading you to do interesting things yourself like parseSource:onErrorRecoverWith: (or whatever). I think this makes an interesting point about our block flexibility. Tim Sent from my iPhone Sent from my iPhone
On 15 May 2019, at 19:37, Konrad Hinsen <konrad.hinsen@fastmail.net> wrote:
Am 15.05.19 um 15:26 schrieb Atharva Khare:
I think in python, you use Lambda Expressions. Here is how I would do it in python3: import math f = lambda x: math.cos(x) + x d_f = lambda x: (f(x + 1e-8) - f(x)) * 1e8
Lambda expressions are indeed Python's anonymous functions, but no Python programmer would create a lambda expression only to assign it to a variable. Doing this in an article to "sell" Smalltalk might well have the opposite effect.
Konrad.