One point worth making is that Python lambdas are artificially restricted: the body of a Python lambda may only be a single expression, not a sequence of statements. This restriction is for ideological reasons (the BDFL does not *want* you to do that) not for technical reasons. Lisp and Algol 68 were doing lambda expressions in the 60s.
As well as function (x, y) { ... }, modern Javascript has (x, y) => ... with subtly different semantics. On Thu, 16 May 2019 at 01:03, Hilaire <hila...@drgeo.eu> wrote: > Hi, > > We, Smalltalkers, use bloc of code as easily as we breathe air. > > I am writing an article on Smalltalk programming for a French > mathematics teachers magazine. > > To illustrate the simplicity of Smalltalk, I would like to compare how > the bloc of code 'f' and 'df' below will be implemented in Javascript > and Python: > > > f := [ :x | x cos + x ]. > df := [ :x | (f value: x + 1e-8) - (f value: x) * 1e8]. > > Here f is a way to implement a function and df its derivate. > > Do some of you knows how it will be written in Javascript and Python > with their own ad-hoc anonymous function? > > Thanks > > Hilaire > > -- > Dr. Geo > http://drgeo.eu > > > >