<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">Op wo 22 aug. 2018 18:40 schreef Steven D'Aprano <<a href="mailto:steve@pearwood.info">steve@pearwood.info</a>>:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Chris' conclusion is that anonymous functions are inherently hard for <br>
many beginners to learn, regardless of whether the syntax is called <br>
"lambda" or "function".<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Civilization itself had trouble with the concept. Functions as mathematical objects in their own right were only conceived (late) in the 19th century. Church's lambda notation was the first way to write down a function without naming it, in the 1930's. And a proven consistent model for lambda calculus was only provided by Dana Scott in the 1970's! </div><div dir="auto"><br></div><div dir="auto">So clearly these mathematical developments haven't yet entered high school mathematics, which remains firmly set in an 18th century mindset, where we can interchangeably write down f or f(x). </div><div dir="auto"><br></div><div dir="auto">Unfortunately modern computer languages require more, so it is up to the comp sci teacher to fill the gap.</div><div dir="auto"><br></div><div dir="auto">But let's not blame Church's notation for that.</div><div dir="auto"><br></div><div dir="auto"> λ f.(λ x. f(x x)) (λ x. f(x x))</div><div dir="auto">lambda f: (lambda x: f(x(x))) <span style="font-family:sans-serif">(lambda x: f(x(x)))</span></div><div dir="auto"><span style="font-family:sans-serif"><br></span></div><div dir="auto"><span style="font-family:sans-serif">(Yeah I know it doesn't work in eagerly-evaluated Python).</span></div><div dir="auto"><span style="font-family:sans-serif"><br></span></div><div dir="auto">Stephan</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
That matches my own observations, interacting with newbies on various <br>
mailing lists, as well as my own personal experience.<br>
<br>
I believe that many people have a lot of trouble grasping the concept of <br>
functions as first-class values capable of being passed to other <br>
functions as data. It requires a major rethink of the way we think of <br>
functions. We go from treating them purely as verbs:<br>
<br>
sort the list<br>
<br>
to nouns in their own right:<br>
<br>
process the sort # the what now?<br>
<br>
<br>
Not "process the sorted list", but reify the sort verb into an actual <br>
thing (an object or value) and then process that thing itself.<br>
<br>
This is mind-bending when you think about it, far more mind-blowing than <br>
the normal linguistic process of nouning verbs and verbing nouns. No <br>
wonder people take a while to get fully comfortable with the concept. It <br>
took me a long time to stop writing code like this:<br>
<br>
map(lambda x: len(x), sequence)<br>
<br>
instead of simply map(len, sequence). I doubt it would have taken any <br>
less time if it were <br>
<br>
map(function x: len(x), sequence)<br>
<br>
instead. Aside from having to learn the correct spelling ("lamdba"?) it <br>
was never the *name* that gave me trouble.<br>
<br>
Of course there is a cost for beginners to having to learn a name, and <br>
the less often the name is used, the longer it takes (unless it is <br>
extremely memorable). But that cost is paid for, with interest, later, <br>
as a journeyman or journeywoman programmer.<br>
<br>
<br>
> In my own experience teaching, I find that many concepts are easier to<br>
> introduce if I avoid the Python jargon until after I've explained what it<br>
> does. This is supported by education research. Some light Googling found a<br>
> study on the topic [0] that is consistent with my own observations.<br>
<br>
I agree. When I teach my students function transformations in maths, any <br>
time I use the technical terms translation, dilation and reflection, I <br>
follow up with the common terms shift, stretch, and flip, and vice <br>
versa. I make a point of always associating the imprecise plain English <br>
words with the precise technical terms.<br>
<br>
Nevertheless, it is important that I teach them the technical terms too.<br>
<br>
<br>
-- <br>
Steve<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank" rel="noreferrer">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div></div></div>