Live data from Hacker News

Conversations with a six-year-old on functional programming (2018)

byorgey.wordpress.com

11–20 of 161 posts

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

#11
I was 16 and learning FORTRAN at school. I was a lazy bum at that time (well, that stayed ;-), didn't really prepare, and at the final exam, the teacher asked me in what order the program is executed. Not knowing any better I replied "a value is calculated when the rest of the code needs it" (like in regular math that we did a lot at the time too). She said "not correct, it executes in the order it is written".

-- I doubt she knew anything about functional programming back then.

-- It took me 40+ years to get to the universe where this answer was not completely laughable.

-- And meanwhile what 16 y.o. kids were doing at the time, 6 y.o ones are capable of doing now.

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

#12

Maybe we should let kids be kids and do kids stuff instead?

what by ignoring their questions? the difference between engaging with their curiosity and forcing stuff on them is... not at all nuanced, really.

The question of the kid was legit, but the "a free theorem is when you can say something that is always true about a function machine if you only know its type, but you don’t know anything about what it does on the inside" is likely not what he asked for.

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

#14

I find kids understand the concept of functions really intuitively if it is stated simply - input -> func -> output, it doesn't have to be difficult maths, and it can make for some great games. It looks a little intimidating if using the notation in this article but they easily grasp that a function transforms inputs and returns outputs, and it can be a fun introduction to maths and programming, and then later to thi…

Agreed! My kids are slightly older but we've long enjoyed a roadtrip game that's a variation on 20 questions: "give me an input, I'll respond with an output, then you guess what the 'machine' [algorithm|function] did". They'd get to provide one input, I'd respond w one output, then they'd get one chance to define the operation -- to which I'd respond only yes or no -- before the next person's turn to test it. Whoever solves it gets a point (if we're keeping score; not important). Then the next person gets to be the function maker. They got pretty good at hypothesizing plausible solutions and refining them to hone in on the precise answer, and it was more interesting than standard 20 questions.

It's also fun to go beyond strictly numeric types, eg responding to a number with the name of a country, or turning a letter or word into a number, etc.

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

#15

Earlier quoted context omitted.

what by ignoring their questions? the difference between engaging with their curiosity and forcing stuff on them is... not at all nuanced, really.

The question of the kid was legit, but the "a free theorem is when you can say something that is always true about a function machine if you only know its type, but you don’t know anything about what it does on the inside" is likely not what he asked for.

Fair, tbh it may not have been needed, but I also struggle with letting go the original question asked even though the child may have moved on! Still, this example is hardly robbing anyone of their childhood.

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

#17

I find kids understand the concept of functions really intuitively if it is stated simply - input -> func -> output, it doesn't have to be difficult maths, and it can make for some great games. It looks a little intimidating if using the notation in this article but they easily grasp that a function transforms inputs and returns outputs, and it can be a fun introduction to maths and programming, and then later to thi…

Agreed! My kids are slightly older but we've long enjoyed a roadtrip game that's a variation on 20 questions: "give me an input, I'll respond with an output, then you guess what the 'machine' [algorithm|function] did". They'd get to provide one input, I'd respond w one output, then they'd get one chance to define the operation -- to which I'd respond only yes or no -- before the next person's turn to test it. Whoever…

Awesome version of 20 questions. My parents are biologists and we played 20 questions with plants/animals on road trips growing up. The games were intense! Learned a ton.

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

#19
post #18

Surprising because I have seen few 6 years olds can do multiplications and divisions. If I'm not mistaken, standard US 1st grade curriculum expects kids to be familier with only addition below 100 and subtraction in low teens.

Some people get it earlier. Some people never really get it.

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

#20

Earlier quoted context omitted.

what by ignoring their questions? the difference between engaging with their curiosity and forcing stuff on them is... not at all nuanced, really.

The question of the kid was legit, but the "a free theorem is when you can say something that is always true about a function machine if you only know its type, but you don’t know anything about what it does on the inside" is likely not what he asked for.

The author acknowledged that was a bit much and pivoted it to a game that his son loves, who put you in charge of taking that away from him?

> This seemed a bit beyond him [...] But the whole conversation had given me a different idea. "Hey, I have a good idea for a game," I said. [...] He immediately liked this game and it has been a huge hit; he wants to play it all the time.

It's probably made even better by being 'the game that daddy reads about/does at work'.

Post reply on HN