
Conversations with a six-year-old on functional programming - weatherlight
https://byorgey.wordpress.com/2018/05/06/conversations-with-a-six-year-old-on-functional-programming/
======
zwass
Brent is one of the greatest teachers I've ever experienced. I used to take
classes from him (and TA some others he taught) and was consistently blown
away by his enthusiasm and capacity for sharing concepts. He has a great essay
on pedagogy as well ([https://byorgey.wordpress.com/2009/01/12/abstraction-
intuiti...](https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-
and-the-monad-tutorial-fallacy/))

If you're interested in learning some of the beautiful foundations of
functional programming, I highly recommend checking out the lecture notes and
assignments from his Penn CIS 194 class
([http://www.cis.upenn.edu/~cis194/spring13/lectures.html](http://www.cis.upenn.edu/~cis194/spring13/lectures.html))

~~~
teirce
I'll second this; he is a fantastic teacher. I had the incredibly fortunate
opportunity of learning from Brent in my undergrad at Hendrix, where he
currently teaches.

There are other comments here that praise his patience with regard to teaching
these topics to a child. I can say without a doubt he maintains the same
patience with all of his students - not just his children. If you ever have
the opportunity to learn from Brent (be from a course, blog, or talk), I would
highly encourage it.

I'm glad to see a post of his making its rounds on HN.

~~~
galdosdi
You did CS at Hendrix College? I did too ('11) and can't help mentioning it
even though I have little to say... because hey, small school, tiny
department, it's not often you run into another Hendrix CS alum, even
virtually. And after years in "industry" I really appreciate the surprisingly
good CS education there for a not well known school

How's the dept doing these days? Is Ferrer still there?

~~~
gjf2a
Hi Domingo, This is Dr. Ferrer. I am pleased to tell you that I am still at
Hendrix College, now completing my 16th year. We're doing well. We hired Dr.
Mark Goodrich after Collins retired (2014), and we hired Dr. Brent Yorgey (the
author of this blog post) in 2015 after Burch departed for Google. Both have
been fantastic contributors to the CS program and to Hendrix College.

I'm glad that your education has served you well! I'd love to hear an update
from you when you get a chance.

~~~
azinman2
I love HN for all these random connections, even if I have no skin in the
game!

~~~
senorsmile
Me too. I feel like the world is not as big as it actually is!

~~~
mar77i
It's not surprising, it's actually a birthday paradox kind of thing.

------
dyladan
What is truly astounding about this is the patience to even attempt to explain
free theorems to a 6 year old. Most parents would likely answer "math" and
that would be the end of it. I don't (yet) have kids, but when I do I hope I
have the wherewithal to recognize and take advantage of moments like these.

~~~
avip
Note kid asked "dad what are you doing", not "what is functional programming".
That's a simple call for attention, and it was equally suitable to close the
book and play frisbee with him.

~~~
ascorbic
No. Children like to copy their parents, and want to learn about what they do.
If a six year old wanted to play frisbee, he probably would have asked to play
frisbee. At the very least he would've made his boredom clear pretty quickly.
Yes, he wanted attention from his dad, but best of all was being able to learn
about dad's grown up stuff by doing something they both enjoyed.

------
ummonk
>\lambda x.\, 6 was also surprisingly difficult for him to guess (though he
did get it right eventually). I think he was just stuck on the idea of the
function doing something arithmetical to the input, and was having trouble
coming up with some sort of arithmetic procedure which would result in 6 no
matter what you put in! It simply hadn’t occurred to him that the machine
might not care about the input. (Interestingly, many students in my functional
programming class this semester were also confused by constant functions when
we were learning about the lambda calculus; they really wanted to substitute
the input somewhere and were upset/confused by the fact that the bound
variable did not occur in the body at all!)

Just goes to show, our intuition works on linear types.

~~~
taeric
I'm curious what you mean. Is the problem that it is a constant function, or
that you are asking them to ignore parameters? Or is that missing the point,
still?

~~~
jackpirate
A function with a linear type uses it's parameters exactly once. The concept
of "linear type" doesn't relate to a the concept of "linear function" except
in an abstract mathematical way.

~~~
judofyr
Well, a linear function is a function where you can only use the parameter
once when expressed in its Taylor expansion. E.g. these are not linear:
x^2=x*x (used twice), exp(x)=1+x+... (used infinite times). It’s a very
symbolic way of thinking about it though, and not what you usually consider an
important property of linearity.

~~~
RaitoBezarius
Not all linear functions possess a Taylor expansion, as not all linear
functions are continuous, example:
[https://en.wikipedia.org/wiki/Discontinuous_linear_map](https://en.wikipedia.org/wiki/Discontinuous_linear_map)

But, your statement is true for all _real-valued_ linear functions AFAIK.

~~~
ginnungagap
You still need to worry about the domain, in general there are plenty of real
valued discontinuous linear functions (or functionals) from an infinite
dimensional Banach space to R.

In finite dimension however linear functions are continuous

------
osteele
Fun(ctional)!

When my daughter was in 4th grade, I volunteer-taught a group of pull-out
4th–6th graders, so that she could have some peers to do math with.

You might enjoy this set of math worksheets I created for them.
[https://www.scribd.com/document/15720543/Squarrows](https://www.scribd.com/document/15720543/Squarrows)
[EDIT: now also at
[https://drive.google.com/open?id=1hfzm3Rvm4xpwp_xHUKBHxuIEgf...](https://drive.google.com/open?id=1hfzm3Rvm4xpwp_xHUKBHxuIEgfecZkiI)]

I was learning category theory at the time. I gave them some element-chasing
problems so they could work on the same areas I was studying, although at a
different level of abstraction.

We also did some stuff on permutahedrons, and relating single-character-
replacement paths (I think Nabokov calls these “rooks path”, when each step is
a word) from AAA → BBB, to geometric cubes, and 2³, etc., but I didn't collect
the worksheets for those into the same document.

~~~
gowld
Is there a non-scribd (Google Drive) way to download the PDF?

~~~
osteele
I put it at
[https://drive.google.com/open?id=1hfzm3Rvm4xpwp_xHUKBHxuIEgf...](https://drive.google.com/open?id=1hfzm3Rvm4xpwp_xHUKBHxuIEgfecZkiI).
Please let me know if that fails, and I’ll try to fix it.

~~~
gowld
Thank you!

------
jawns
When my son was around five or six, I did a similar exercise to explain the
difference between prime and composite numbers.

I told him that a number X is composite if you can fit X apples into buckets
and end up with the same number of apples in each bucket.

I drew 6 apples and asked whether they could be divided into buckets with an
equal number of apples in each. It was immediately obvious that they could. My
son circled one group of three apples, then another group of three apples.

Then I drew 7 apples. He realized that you couldn't divide 7 apples into
baskets and have each basket contain the same number of apples.

Voila! A prime number.

Then we started talking about the frequency with which prime numbers occur on
the number line, how important they are to fields such as cryptography, and
the existence of dense Bragg peaks among primes in judiciously chosen
intervals. By the end of the conversation, he had discovered a new recursive
prime generator and submitted a paper on it to arXiv. Who knew?!?

~~~
kazinator
> _I told him that a number X is composite if you can fit X apples into
> buckets and end up with the same number of apples in each bucket._

Wrong; X is composite if you can fit X apples into buckets and end up with the
same number of apples in each bucket, _with at least two apples in each
bucket_.

 _" You gotta tell the children the truth. They don't need a whole lot of
lies. Cause one of these days, baby, they'll be running things."_ \- Jimi
Hendrix, "Straight Ahead"

~~~
ianamartin
This is something I saw over and over again long before I had a serious
interest in technology or science at all. It’s an attitude that’s rampant in
liberal arts courses.

There are “kiddie” versions of everything from History to to Music Theory to
Grammar. It used to really frustrate me in undergrad how many things taught as
almost moral absolutes were upended the following semester.

I sort of get it that even in junior high and high school, the teachers don’t
really know anything beyond the kiddie version, so that’s what gets taught.

But at the college level, there’s no excuse for that. There’s a certain amount
of science envy that some liberal arts professors have. They want to be able
to say that there is one and only one way to understand a historical event or
way to compose music.

Milton Babbit was famous for this in the music composition world and argued
that music needed to be “elevated to a higher form like that of math or
physics” and that no one expects advanced math to be accessible to lay
persons. Therefore music shouldn’t be comprehensible by anyone who doesn’t
have a PhD in music theory or composition. This was actually a pretty popular
attitude in the “classical” music world from the 1950s to the early 80s, and
the music written during that time reflects it.

Sorry to get so far off on a tangent, but while that specific fad has come and
gone in music composition, there remains an inferiority complex among liberal
arts academia that is extremely problematic and a general attitude among
professors of all stripes that some people just can’t handle the truth: that
outside of religion, there are no absolute truths.

Getting back to the Hendrix quote, I absolutely agree. Teach children as much
of the truth as you know. They can take it. In my own experience teaching
violin, I’ve found that I get the best response when I treat the students the
most like adults. About 20 years ago I started bringing in little vignettes
about music theory and history with my youngest students (4-6 years old) as a
break between lesson segments where we were focusing very intensely on
specific violin techniques. When I realized that they enjoyed both the context
switch and the color commentary about why exactly we do these kinds of things,
I brought more and more of that to the table, and it’s been very successful.

Obviously, this isn’t a robust study, it’s not meaningful in a larger scale,
and it doesn’t prove anything at all.

But if the theory is that young students can handle a lot of uncertainty and a
lot of advanced material at a young age, then my experience is, at least, not
evidence that it’s false.

Deep down inside, I think that we need to be a lot less careful, protective,
and hand-holdy about what we expose our children to. They can handle it.

~~~
majos
I agree with a caveat, Sometimes I see people take this sort of complexity
(there are limits to what we know, science is fallible, there are different
interpretations of pretty much everything) and run with it (YouTube conspiracy
theories constitute "doing your own research", experts are no better than
amateurs and therefore there's no reason to study anything hard). It's kind of
a fine balance between going independent too little and too much.

~~~
ianamartin
I agree this can be a problem. I think the best vaccine against people going
too far that direction though is honesty and a deeply understood sense of how
we know what we think we know and how we can separate crazy-talk from
legitimate possibilities. I guess, what I mean is that it's never to early to
talk about epistemology, the scientific method, falsifiability, and the things
that guide us down that sometimes narrow path.

------
abecedarius
This game can be played in a group, too:
[https://en.wikipedia.org/wiki/Zendo_(game)](https://en.wikipedia.org/wiki/Zendo_\(game\))

> once the guesser thinks they know what the function does, the players switch
> roles and the person who came up with function specifies some inputs in
> order to test whether the guesser is able to produce the correct outputs.

In Zendo when the guesser offers the wrong rule, the 'master' must tell them
an (input,output) pair where the guess disagrees with the rule the master had
in mind. Then play continues.

~~~
evincarofautumn
Come to think of it, I find Zendo much harder than the game described in the
article. I think it’s because the inputs (arrangements of shapes) are more
complex than numbers, and the outputs (Booleans) give you less information
than numbers.

~~~
abecedarius
I've actually never gotten to play real Zendo, but you can make up your own
class of koans, like Lisp programs or regexes. Maybe the real-worldness of
arrangements of pyramids does give them more of a Zen feel?

------
motohagiography
This is fantastic. Reminds me of Hofstadter's conversations between Achilles
and a Tortoise.

The trouble with most math I've encountered isn't the concepts, it's the
quality of the abstractions we use to represent and interpret them.

The best(worst) example I can think of is the Alice/Bob description of
cryptographic protocols, where somebody's idea of teaching is, "let's take
these symbolic representations and instead of just shouting them at you
slowly, I will obfuscate them with a set of conceptually unrelated words and
repeat the representation word for word in a more patronizing way."

Great piece of writing.

~~~
abdullahkhalids
I disagree with your example being a bad and reason is right there in your
comment: the word "protocol". From wikipedia we find that a "communication
protocol is a system of rules that allow _two or more entities_ of a
communications system to transmit information...", where I have underscored
the essential phrase and cryptographic protocols are just a subset of
communication protocols.

The reason that Alice and Bob are introduced is because they are different
entities and each has different powers, restrictions and goals. If you want to
do a correctness or security analysis of a protocol, introducing and defining
these parties is hugely important and useful. Otherwise, its very easy to make
mistakes about where information is in the system and how it is being
manipulated. More generally, there is a philosophical approach called
operationalism [1] that demands that all science theories be couched in terms
of protocols so we don't make mistakes about what they say.

[1]
[https://plato.stanford.edu/entries/operationalism/](https://plato.stanford.edu/entries/operationalism/)

~~~
threatofrain
What about a definition of protocol that allows sending messages to yourself
for recursion.

~~~
falcor84
What about it? Why should it be treated differently?

~~~
threatofrain
It doesn't require an extra party to do useful things across a protocol, where
the discussion implies it does.

------
thomasfedb
And it works with procedural programming also! I've been teaching programming
in schools since I was in school myself - teaching the kids who know more than
their teachers, as well as the kids that teachers don't think are ready to
code.

Procedural thinking is something that anybody who knows socks come before
shoes can do. Conditionals can be understood by anybody who wears different
clothes on a weekend than on a schoolday. Loops can be understood by anybody
who can eat a bowl of soup by drinking a single spoonful and then doing that
again and again until the soup is gone.

Kids can definitely engage in computational thinking from a young age. We just
need to offer them the opportunities to do so.

------
heinrichhartman
I had a somewhat similar encounter with a 4 year old (!), who blew me away
with his ability to solve arithmetic puzzles:

[http://heinrichhartmann.com/blog/2016/06/12/Box-Counting-
Ari...](http://heinrichhartmann.com/blog/2016/06/12/Box-Counting-
Arithmetic.html)

It's a great joy to work with such gifted young minds.

~~~
wahern
Such precociousness is often[1] an indicator of abnormalities and handicapped
general intelligence. For example, if our son independently began to read too
early the initial reaction of my spouse, a Speech-Language Pathologist, would
be to freak out rather than to be filled with pride.

Perhaps you know this and used "gifted" in its more euphemistic sense. In any
event, I mention this not to correct you but to address the parental anxiety
engendered by examples such as you gave.

[1] Depending on the activity and age of onset, they can be so strongly
correlated that attentive educational professionals would recommend diagnostic
tests to identify any condition (often some category of autism) and permit
early intervention to minimize the negative developmental aspects.

~~~
gowld
The comment above is condescending and misleading.

Being precocious doesn't mean autism, and no professional SLP would "freak
out" at an early reader.

Being smart is an "abnormality", and autism is not "handicapped general
intelligence".

Warning signs for autism include obsession with letters and numbers _without
understanding meaning_ , not being able to reason about math and discuss
mathematical topics.

~~~
sidlls
It isn't misleading or condescending. In fact as a parent of an autist I find
your comment to be the condescending one. The person you're responding to
didn't say autism was the same as handicapped general intelligence, but that
extreme precociousness is often correlated with atypical development in other
contexts.

~~~
wahern
FWIW, to be honest I had autism spectrum disorders in mind, though I certainly
don't equate autism with handicapped general intelligence. I intentionally
avoided using the term autism (even though some of the best examples I had in
mind come from studies on autism spectrum disorders) as it's such a very broad
label with different etiologies and different constellations of traits. An
autistic child with fragile X syndrome is likely to have many objectively
identifiable and severe disabilities, whereas some other child with autism
might have few or no disabilities, especially in a more diverse and
accommodating society that isn't organized to punish people who don't easily
fit into a mold. I wanted to point out that some seemingly desirable trait can
actual reflect other, categorically undesirable traits. Such value judgments
are especially tricky when label like autism are thrown into the mix, and in
any event I wasn't keen to attempt to identify anything in particular as
negative.

Back to my original point: there are many more ways for things to go wrong
than for things to go right. Similarly, abnormal faculties often coincide with
abnormal deficiencies--were it otherwise genetic evolution dictates it
wouldn't be abnormal. That basic calculus means that when abnormalities
emerge, all things being equal and long before we can know anything about how
things will play out individually, it's not rational to be envious or given to
feelings of inadequacy, which is precisely what we're doing, intentionally or
unintentionally, when we're drawn to stories about precocious behavior.

It was eye opening to come to learn how my spouse as well as other people I've
spoken with who have studied various aspects of child development have a very
different perspective on abnormal and out-of-order milestone development. At
the same time, these are the people least likely to construe debilitating
abnormalities in the same negative light as wider society. But they understand
1) the cold, hard calculus and 2) that any abnormality, whether widely
construed as positive or negative in society, comes with a real, _additional_
cost in time and attention, particularly for attentive parents who wish to
ease their child's transition to independence given the harsh realities of the
world. Simply recognizing and internalizing differences so as to avoid
confusion later on in life is a real burden on everybody involved.

------
mcv
I've failed as a parent. My oldest is 9 already, and we still haven't
discussed functional programming.

Well, maybe the 3 year old still has a chance.

~~~
weatherlight
Mines 1 1/2...Better have "The Talk about FP" soon.

------
kiliancs
> “A function is like a machine where you put something in one end and
> something comes out the other end. For example, maybe you put a number in,
> and the number that is one bigger comes out. So if you put in three, four
> comes out, or if you put in six, seven comes out.”

Examples are such a useful tool to explain complex subjects and make them
approachable.

~~~
rocky1138
This is my biggest complaint with manpages, historically. Many of them don't
have examples and only describe the command switches in a list.

~~~
gowld
EXAMPLES is one of the primary categories of man pages. Your broader problem
is that "The full documentation for * is maintained as a Texinfo manual", and
most people never learned how to access and navigate those.

[https://www.google.com/search?q=%22The+full+documentation+fo...](https://www.google.com/search?q=%22The+full+documentation+for+*+is+maintained+as+a+Texinfo+manual%22)

------
dzink
Teaching CS by simple analogs is the most intuitive way for people to grasp
it. I wrote lectures for a 8 week 3hrs a week CS50 level course and completely
nontechnical people loved every analog. Example: Front end vs backend vs
middleware development is like a Macys window display. The figures and
placement are Html, colors are CSS, backend database is the store warehouse
and the employees are RoR, PHP, Go or another middleware that connects the
pieces. Just like any warehouse - you want most frequently accessed items in
the front - so you need to design your database for quick and efficient access
to the information you will need to show users most frequently.

Since then I’ve been thinking of a wikihow- or w3schools- like site that
explains a CS50 level class online and can expand to reach Python, or Go or
another language in depth. A second parameter to teaching is the pace - the
speed of lecture and the steepness of the learning curve. Maybe we could
structure a slow or fast paced versions of each module and the viewer can pick
or customize a track for themselves. Is anyone interested in joining or
contributing to such an effort?

------
make3
Jesus that shows you how uneven of a baggage children have when they start
going to class.. this little dude has a computer science prof as his father, &
is doing abstract logic problems at 6 yo, for fun no less!!

my cabinet maker father can't spell a sentence without making four different
mistakes in his native language, and my social worker mother literally
grimaces with pain anytime something resembling math is distantly mentioned

------
d--b
I am surprised. Growing up in the 80s in France, this was a classic exercise
for 7/8 year olds. I remember doing it a million times in school. They
presented the problem as 2 columns with numbers on the left and on the right,
and a box at the top, which we also called the "machine". It had a little
arrow as well to show which way the numbers would go through the machine. The
exercise was either "find what the machine does" or "guess the input" or
"guess the output", sometimes combined together.

------
Delfino
This reminds me of when I explained inverse functions to my kids. I was about
to teach them to my grade 10 students and I wanted to use the Dr. Seuss book,
The Sneetches to give an example. I asked my kids if I could borrow their
copy. When they asked me what for, I told them and they ended up asking what
inverse functions were. I similarly played a game where I told them what a
certain function machine did and they had to come up with a machine that undid
what my machine did.

------
curuinor
[http://worrydream.com/AlligatorEggs/](http://worrydream.com/AlligatorEggs/)

------
acobster
This is so awesome. I'm consistently amazed at how much kids can understand
intuitively, even when they can't express their understanding in precise
language. For example, my partner teaches lower elementary at a Montessori
school. Not everyone understands it, but she's managed to teach some basic
algebra, including to several of her first-graders.

------
Steuard
This sounds a lot like the card game "New Eleusis":
[http://www.logicmazes.com/games/eleusis/index.html](http://www.logicmazes.com/games/eleusis/index.html)
[http://matuszek.org/eleusis2.html](http://matuszek.org/eleusis2.html)
[http://matuszek.org/eleusis0.html](http://matuszek.org/eleusis0.html)

It's meant to "simulate scientific research", sorta: one player ("God" or
"Nature") comes up with a secret rule for what cards are legal to play in a
given situation, and then the other players take turns playing cards to figure
it out. It's a lot harder than you think, even with quite simple rules. (The
scoring system is meant to reward a "God" player for coming up with a rule
that's not obvious but still guessable.)

------
skate22
I hope my kids want to learn and are curious about how things work like the
OP's kid!

I dont want to be one of those parents that pushes their kid to the point that
they dont enjoy learning or suffer socially.

Asking for a future me: how do you give your kid the best chance / environment
to develop socially, but still enjoy learning & embracing the nerdier things?

~~~
icc97
I sent mine to a Steiner / Waldorf school on the hope that this is more of a
social / confidence building environment. Then I surrepticiously feed her
inner geek at every opportunity I can find. My personal current favourite is
Wild Kratts [0] which teaches a amazing number of things.

Also we send my daughter to a violin school where they teach the suzuki method
which has a fairly nerdy type of group of parents that go there.

So it means she's in a school that accepts most types of people whilst
exposing her to nerdy things outside of school.

Curiously I found that a lot of the parents who send their kids to a Steiner /
Waldorf school tend to be nerdier. The best example was a couple where the
mother was had a Philosophy degree with a Physics PhD and the father travelled
around the world as a street puppeteer.

[0]:
[https://en.wikipedia.org/wiki/Wild_Kratts](https://en.wikipedia.org/wiki/Wild_Kratts)

~~~
bitcoinmoney
this is super expensive. How much do you need to earn to send your kids to
schools like this.

~~~
icc97
In Belgium the Steiner school is free

------
kyleperik
I love to hear about conversations with people who aren't exposed to these
kinds of concepts. I think it's interesting to hear a more simple opinion.
Sometimes I talk to my wife about ideas I've been thinking about and she can
give some helpful feedback despite not having experience with any of the
underling concepts.

------
petra
Side question: maintenece of functional programs is easier, because you don't
need to think about state.

Could it be used to create a functional programming language, easily
understood by non-programmers or beginners , so they too could take a program
and adapt it to their needs ? Does such language exist ?

~~~
darkkindness
Maybe Pyret?

[https://www.pyret.org/](https://www.pyret.org/)

~~~
nickpsecurity
One of the folks behind that is also involved in this:

[http://www.bootstrapworld.org](http://www.bootstrapworld.org)

They're claiming to get good results teaching young people a number of
important topics, including coding. They're also either using Pyret or
planning to use it.

------
j2kun
Functional programming? What he's describing is machine learning! :)

~~~
mar77i
Actually, for a rather unconventional understanding of the term "machne
learning", which is basically anything that makes living and working with
machines easier, you don't necessarily need to make the machine's
functionality more versatile. It might be enough to boost its user's
understanding. With more effect, too, because an informed user by far beats
any RNN-based AI.

What I'm actually trying to say is that brains are simply better at learning
to grok machines than machines are at figuring out how to brain.

------
ujal
I've grokked programming only after being exposed to Lisp. Before Lisp,
learning how to programme seemed like a never ending exercise. After, I
realised I already know everything I need to know - data in, data out…

~~~
cup-of-tea
Yes. There is an old piece of sage advice: learning Lisp will make you a
better programmer, whether you actually end up using it or not. Any paradigm
you can think of is really just something you could do in Lisp...

------
fao_
> (and to be fair, free theorems are only interesting when polymorphism is
> involved which I definitely didn’t want to go into).

"there's a thing called polymorphism, and it means 'of many forms', what it
means is that if you put the thing in, you're guaranteed to get a specific
type of thing out, but it might be different depending on what you put in. So
you put words into the machine, and letters come out, but if you put lists of
numbers in, numbers come out."

------
OJFord
I remember exercise sheets at school (in the UK) like this - I think called
'number machines'.

I _hated_ it; felt patronised by the illustrations of these machines, so I
rebelled by trying to come up with a different correct solution - aware that
there were infinitely many answers given just a few example domain/range
pairs.

But if anyone's interested in them for a car journey or some time you can't
play this game aloud, there ought to be examples available online aimed at
teachers.

~~~
gowld
What's to hate? You solved the problems correctly and creatively. Any given
reasonable limits on complexity of solutions (simpler -> better, Occam's
razor), there are only a few solutions to any given problem.

~~~
OJFord
I was just being facetious. It was too easy to identify that numbers are being
doubled, so I'd contrive something else instead, that happens to be equivalent
for the few examples given.

------
dclowd9901
I always liked to imagine a scenario where my daughter would invite me to her
class to talk about what I did, and I would try to explain the concept of
programming to young children. I would pretend to be a robot, and they would
have to command me to do things, but I would only do them exactly as they
described them.

I had a similar experience when I was in school and it really stuck with me.
Kids love this shit, they just need it in a way that lights up their minds a
bit.

------
77pt77
The difficulty in conceiving of a constant functions seems similar to the
difficulty in recognizing that

> if 4 is prime then all numbers are prime

Is a true theorem (and things along these lines)

~~~
pbhjpbhj
>> if 4 is prime then all numbers are prime

>Is a true theorem (and things along these lines)

Saying "4 is prime" "primes are non-composite, ..." reduces to error; at least
one of these premises is false.

?

------
mbil
> It’s called the function machine game. I will think of a function machine.
> You tell me things to put into the function machine, and I will tell you
> what comes out. Then you have to guess what the function machine does.

Cool, this sounds like a general form of the picnic game[0].

An input to the "picnic" function is a food (or other object), and the output
is whether or not it can be brought to the picnic. The picnic game's hidden
function that needs to be uncovered is a predicate function. E.g. if the
hidden function is "Things that start with the letter A", then "apples",
"anchovies", and "albatrosses" could be brought to the picnic, but not
"bananas", "cameras", nor "dessert". In that example, the function would look
like:

    
    
      lambda x: x.firstLetter() == 'a'
    

[0] [https://www.thegamegal.com/2011/06/11/going-on-a-
picnic/](https://www.thegamegal.com/2011/06/11/going-on-a-picnic/)

~~~
uryga
my favorite snack is "" ! (pronounced " ")

------
TuringTest
I wish someone would explain all of Category Theory like this to _me_.

~~~
darkkindness
You might enjoy
[https://graphicallinearalgebra.net/](https://graphicallinearalgebra.net/).
The author uses Legos to describe algebras and diagrams to describe symmetric
monoidal categories.

~~~
offbytwo
Thanks for this!

------
dottKon
What a great and heartwarming story! It really puts a great example to the old
rule of thumb that 'you can be sure you understand the concept once you
successfully explain it to a five-year old'.

------
your-nanny
Cool game; used to do something like that with kids, but more in context of
sequence patterns. still, the game is limited to functions that are specified
intensionally. Extensionally specified functions with no readily identifiable
intension (like a function whose pairs are the result of a random pairing) are
not really guessable. Oh well those are boring anyway...

------
kowdermeister
I enjoyed reading this story :) Nice buildup to the gate of complex problems.

I remember that at elementary school we turned on a bunch of C16-s at the same
time and we tested random number generators and some showed the same value,
cool demo of determinism

instead of xλ6 I would have chosen xλ3.14159265359 it might lead to different
questions, but who knows, just deeper rabbit holes :)

------
icc97
> Or maybe there is a function machine where you put other function machines
> in and get function machines out!

Made me think of higher order functions as self-replicating machines [0].

[0]: [https://en.wikipedia.org/wiki/Self-
replicating_machine](https://en.wikipedia.org/wiki/Self-replicating_machine)

------
logicallee
If this anecdote is credible (and I don't see any reason it wouldn't be) then
in four years this kid will ask, "What are you reading?" and then the father
will say what he's reading - and then sheepishly as for help from the ten
year-old on the part he's stuck on.

I mean this kid is clearly superlatively gifted.

~~~
gowld
The parent is also superlatively gifted.

[http://ozark.hendrix.edu/~yorgey/](http://ozark.hendrix.edu/~yorgey/)

------
sulZ
When I was working as a math tutor I would sometimes have to explain
composition to a student for an introductory algebra class. When it finally
clicked to them that you could pass functions into other functions many other
concepts seemed to come to them more easily. Those were some of my favorite
moments at that job.

------
sAbakumoff
Poor kid...I imagine how his classmates would react if he offers them to play
machine function game

------
TheKarateKid
I loved reading this. When I was that age, I used to ask so many questions to
my father and I was lucky that he was always happy to not just answer, but
explain everything. If he didn't do that, I may not have followed the path to
where I am today.

------
astoilkov
If you like this article I would definitely recommend this one too:
[https://hackernoon.com/how-my-10-year-old-learned-
javascript](https://hackernoon.com/how-my-10-year-old-learned-javascript)

------
allenleein
For beginner who wanna learn Haskell and Purescript, I recommend those
resources:

[https://github.com/allenleein/brains/projects/9](https://github.com/allenleein/brains/projects/9)

------
rpwverheij
beautiful read, thank you. Does anyone collect these educational inspirational
stories?

~~~
mncharity
> Does anyone collect these educational inspirational stories?

That might be really useful. Maybe one barrier to improved education, is
people having difficulty visualizing it?

Last summer, I tried to explore teaching atoms in early primary, with a focus
on nucleons and nuclei.[1] One big surprise to me in discussions, was a
pattern of non-linear response to my saying "teach nucleons to kids".

One physics postdoc, one with a professional focus on introductory physics
education, replied basically "Absurd! How could you teach muons to kids!" It
turned out that for them, "teach nucleons and nuclei" meant understanding
muons. "Teach ... to kids", wasn't enough to change that image. So they tried
to imagine teaching muons to kids, and exploded.

Another physics postdoc tried to picture kids chalking quantum math on some
graduate seminar blackboard. And was "WTF?" baffled.

A primary-school teacher heard "teach atoms", and tried to picture early-
primary students memorizing and regurgitating 4th-grade paragraphs of
definitions. Because for them, that's what "teach atoms" meant.

And more. These weren't outliers.

I ended up using an analogy. That it was like proposing to teach
kindergarteners about traffic lights. And having highway engineers declaring
"Absurd! There's no way kids could understand those standards documents! And
they're expensive! And the Chinese ones are in Chinese! You're think you can
teach technical Chinese transportation standards documents in kindergarten!?!"

"Red means stop; green means go." "Atoms are sticky little balls that jiggle."

I'd expected that crafting accessible _leverageable_ descriptions would be
hard. And that how well one could achieve transferable understanding, at
various ages, would be an open question.

But I didn't expect that people would initially be so dramatically unable to
_picture the possibility_ of teaching some topics.

People were fine after a "kindergarten traffic lights ... green means go...
not network theory" story to set context. But I wonder...

Might there be a badly underappreciated need for stories like OP? To provide
"Oh wow... I wouldn't have imagined one could teach that... Now I can picture
it..."

That's an idea for helping to disrupt education that I've not seen before.

[1] a crufty slow-loading page, intended merely to set up in-person
discussions, but I've nothing better:
[http://www.clarifyscience.info/part/Atoms](http://www.clarifyscience.info/part/Atoms)

------
deaps
I enjoyed it.

I spend a lot of time listening to people ramble in meetings or
troubleshooting, where I _wish_ they understood the subject matter enough to
explain it as if talking to a six year old.

------
jason_slack
I'm taking a discrete math class right now.

How is this read: \lambda x.\, x - 3 and what is a simple example?

In a discrete math perhaps it is the same as "All x, x is an integer such
that...."?

~~~
craftyguy
The '\lambda x' is just another way of saying "f(x)"

So '\lambda x., x-3' \--> 'f(x): x-3'

Also, I really enjoyed my discrete math courses! The proofs were.. tedious..
but the amount and breadth of 'stuff' covered was excellent.

~~~
jason_slack
It is a difficult course! We are doing graph theory right now.

------
hvass
This is the best thing I've read in really long time.

------
ryanpcmcquen
"If you can't explain it simply, you don't understand it well enough." \-
Albert Einstein

Brent definitely understands it well enough.

~~~
lobster_johnson
Einstein never said that, though:
[https://skeptics.stackexchange.com/questions/8742/did-
einste...](https://skeptics.stackexchange.com/questions/8742/did-einstein-say-
if-you-cant-explain-it-simply-you-dont-understand-it-well-en).

~~~
ryanpcmcquen
Good find! Looks like he said something similar, but never those exact words.

------
gpmcadam
Functional parenting.

Cool!

------
ooronning
Ad redirect on mobile, beware subway commuters

------
phonebucket
great stuff. what is consciously learnt and discovered by one generation can
be intuitive to the next, precisely because of teaching.

also, i love the idea of experimenting on your own children and then writing
blog posts about it :)

------
endlessvoid94
Obligatory "Mindstorms" recommendation: [https://www.amazon.com/Mindstorms-
Children-Computers-Powerfu...](https://www.amazon.com/Mindstorms-Children-
Computers-Powerful-
Ideas/dp/0465046746/ref=sr_1_4?ie=UTF8&qid=1525736070&sr=8-4&keywords=mindstorms)

------
weatherlight
Mines 1 1/2...Better have "The Talk about FP" soon. ;)

------
ferrolho
And _that_ is how a programmer is born.

------
bovik
This is really just a conversation about functions...

------
jrochkind1
omg is that kid gonna be a hacker.

------
tzahola
This brings me back to ~20 years ago when my dad was explaining me Bresenham's
circle drawing algorithm. I was 8 at the time I think.

------
mmirate
Functions? Algebra? How is comprehending _any_ of that, possible without the
sort of abstract/counterfactual thinking that develops around age 12?

~~~
nnq
...who told you that lie? An educational psychologist?

More like "at age 12 even the most incompetent teacher can teach things
involving abstract/counterfactual thinking to even the least intelligent
child"... the bad ol' _" lowest common denominator thinking"_ and the other
horrors of our standardized educational systems :| Unfortunately it's not
economically feasible to lecture to children in a classroom unless you
calibrate on the lowest common denominator.

Also, it's the huuuge difference between "understanding" and "being able to
communicate efficiently in words". People can "grok" very advanced stuff even
if they don't fully command the language for expressing it. Unfortunately most
incompetent teachers are totally incapable of "trying to explain something
beyond the level of the language" but the human brain's pattern matching
engines are not always tied to language...

~~~
mmirate
> ...who told you that lie? An educational psychologist?

[https://en.wikipedia.org/wiki/Piaget%27s_theory_of_cognitive...](https://en.wikipedia.org/wiki/Piaget%27s_theory_of_cognitive_development#Formal_operational_stage)

Fine, I was off by one year.

~~~
fiatjaf
Still a lie. And you still believe in it even after seeing an example in
contrary.

~~~
mmirate
It takes far more than one anecdote to outweigh the evidence in support of
Piaget's model.

------
Amaze
Hii

------
austincheney
The link to the article is not working for me right now, so I cannot see how
they define functional programming. In my years of programming I have seen the
concept of functional programming defined in one of two ways: in context to
call/response or in context to containment/scope.

The call/response perspective emphasizes that functions are instantiated
against a reference that can be called and that such a call returns a value.
The containment/scope perspective emphasizes that functions are a bag of
instructions containing a child scope and thus a lexical structure if nested.
While both descriptions are valid they produce wildly different explanations
and code examples that are often completely unrelated.

