Live data from Hacker News

Conversations with a six-year-old on functional programming

byorgey.wordpress.com

21–30 of 319 posts

Re: Conversations with a six-year-old on functional programming

#21
post #17
post #14

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 c…

lol, is this some elaborate troll?

>troll

Yes

>elaborate

No

Re: Conversations with a six-year-old on functional programming

#22
post #3

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.

I often tell my kids "I'll explain that when you're 16", or "you're too young for that, go out and play". This has proven to be very effective in motivating them to think for themselves, or ask someone more collaborative (s.a mom)

Re: Conversations with a six-year-old on functional programming

#24
post #22
post #3

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.

I often tell my kids "I'll explain that when you're 16", or "you're too young for that, go out and play". This has proven to be very effective in motivating them to think for themselves, or ask someone more collaborative (s.a mom)

the more you try the less they want

Re: Conversations with a six-year-old on functional programming

#25
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.

Re: Conversations with a six-year-old on functional programming

#26
post #3

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.

Dad of 8 here. It makes life so sweet when we acknowledge the child's capacities. Notice it didn't take that much patience...it's almost just a matter of creatively overcoming a language barrier.

I'd think it would also be a great opportunity to have access to a young, malleable mind that's unencumbered by a significant body of past experience and preconceived notions. Every answer is like a pure function...it's derived from first principles rather than coming an existing corpus of 'state'. It seems like a tremendous opportunity to expand your own viewpoint with perspectives that you'd naturally ignore based on your own past experience.

A good friend of mine was the grandson of a couple that ran a school for gifted children. When they retired, there was a video produced about their careers and, at one point, they were both asked what they liked best about their jobs. His grandfather answered, "Getting to speak to the children every day." His grandmother answered, "Getting to listen to the children every day. I always liked her answer better than his.

Re: Conversations with a six-year-old on functional programming

#27
post #14

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 c…

> 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"

Re: Conversations with a six-year-old on functional programming

#28
post #19

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 ?

Maybe Pyret?

https://www.pyret.org/

Re: Conversations with a six-year-old on functional programming

#29

Earlier quoted context omitted.

The child was stuck on the intuition that the argument must change in some way (i.e. that the function was linearly typed).

This and this: >> 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 don't really seem, to me, like they can explain what's happening -- f(x) = 6 is trivially easy to express in terms of arithmetic operations being applied to x. If you assume that a fu…

I wonder if it would have made it any more obvious to explicitly define it as:

f(x) = 0*x + 6

EDIT: Or even, if multiplication is a problem, f(x) = (x - x) + 6

Re: Conversations with a six-year-old on functional programming

#30
post #19

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 ?

It already exists, MS Excel
Post reply on HN