Hacker News new | past | comments | ask | show | jobs | submit login
Conversations with a six-year-old on functional programming (byorgey.wordpress.com)
2074 points by weatherlight on May 7, 2018 | hide | past | favorite | 310 comments

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...)

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)

Agreed! I taught myself programming, and Haskell was my second language. I was at Penn so I emailed Brent out of the blue, and he responded and was so helpful with understanding helping me understand Monoids, not at all judgmental, and so different from all the educational experience I had up until then. And it was serious gateway drug to mathmatics. Funny thing is a few years later I TAed an advanced Haskell class with Stephanie Weirich (https://www.seas.upenn.edu/~cis552/current/index.html), who was Brent's thesis advisor. All started with Brent!

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.

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?

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.

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

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

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

Sure did! Looks like you already have a reply from Ferrer :) but I will chime in to say the department is doing as well as ever. I graduated a couple years ago and was also surprised with how strong my CS background was going into industry. It's definitely served me well.

It's still a small department - I think there were <10 people in my class - but has seen an uptick in growth the last few years. They've made some really great hires recently - obviously Brent, as well as Mark. Both are great teachers and Hendrix is lucky to have them.

This really makes me wish there was a way to watch his courses online! Anyone know of any available?

I'll third this! Brent's class on the art of recursion really taught me quite a lot about how to think about problems in a different way.


His code is also impeccable. Diagrams [0] is a pleasure to read.

[0] https://hackage.haskell.org/package/diagrams

There is an updated set of lectures from fall 2016 [0]. Although I just noted that it's taught by Joachim Breitner rather than Brent Yorgey.

[0]: http://cis.upenn.edu/~cis194/fall16/

This is the text Christopher allen recommended to beginners as the best reference, until he decided to write his own book on Haskell.

After completing that one, he recomended the NICTA github repo https://github.com/data61/fp-course/tree/master/src/Course

Disclaimer: All subject to IIRC

Just read Week 1 of this course - very easy to follow. Although with a different instructor, there are later versions - http://www.cis.upenn.edu/~cis194/fall16/ seems the most recent, with plenty of updates since the spring13 course. I'll be reading more!

Took a class with Brent at Williams College when he visited for a year. Brent is awesome!! :)

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.

It's an immense amount of effort to do it consistently. And it gets harder with each kid, at least for me.

One of the things you figure out is that some kids aren't interested. And if your kid isn't interested in thinking about prime numbers, you're going to be hard pressed to change that. Conversely they will have interests that you don't share, and it's going to be harder for you to participate meaningfully in that beyond being generally supportive. They are individuals that way.

> One of the things you figure out is that some kids aren't interested. And if your kid isn't interested in thinking about prime numbers, you're going to be hard pressed to change that. Conversely they will have interests that you don't share, and it's going to be harder for you to participate meaningfully in that beyond being generally supportive. They are individuals that way.

I grew up in a family with 7 kids and my youngest sibling is just 12 years old. I remember when my younger set of siblings were born, I was thinking "I'm going to teach them EVERYTHING I've learned at a young age, and they will be way ahead of their peers." I failed to grasp just how much of their personality is ingrained in them from their DNA and that they might not have all the same interests as me. It was a great learning experience though -- when I do have kids, I'm not going to try and shove my interests down their throat. I'm going to pay attention to what they are drawn to and give them as many resources as I can so they can pursue that interest as much as they desire.

> how much of their personality is ingrained in them from their DNA

Is this really true? I hope not!

I don't think that personality is completely hard-wired, but different people will strongly tend toward different traits, and two people raised in an identical environment will react differently to that environment.

Interests can be encouraged because there's some flexibility in someone's natural tendencies. It's the old "nature vs nurture" discussion, about which one dominates the other.

Not to mention that siblings by definition each grow up in a different environment. The addition of a new sibling changes the behaviour of parents and other siblings (sometimes a lot, sometimes a little, but it's there).

Perhaps the above poster's sibling looked for other interests because the poster had already 'taken' whatever interests they were sharing. But perhaps not - it's hard (impossible?) to know.

Yes, it's notable that Brent's son first was interested enough to ask him and then stayed interested as he explained.

You can't start telling your child about maths if they're busy doing something else. All you can do is wait for a moment when their curiosity spots something and try to feed that.

Even when you catch their interest it's easy to break it if you can't explain it, so los of kudos to Brent for navigating it perfectly.

My teenage son is a musician and is taking AP Music Theory right now.

I ask him to tell me about what he is learning, and he patiently tries to explain it to me, but I just nod along because I have no idea what he's talking about.

The gist of music theory: It sounds interesting when sounds with simple frequency ratios are played at the same time. E.g., playing a 440 Hz tone at the same time and 660 Hz tone has a 2:3 ratio. Some combinations of frequencies, when played before or after other combos can establish an expectation and then either fulfill it or negate it. E.g., if you take the ratio above and then play 440 + 587, it'll sound like it's moving forward and that the second combo has 'arrived' as you might have expected. The 587 is derived by fixing the first note but inverting the relationship from 2:3 to 3:2 (and then doubling the frequency of the second so you don't have to move so far from 660).

Most everything beyond is attaching labels to the frequencies and combos. Just as we have names for frequencies of light (red, yellow, blue) and patterns (gradient, checkerboard) there are names for frequencies of sound (A, C#, E) and their combinations (major, minor). There are also more esoteric terms (chiaroscuro in painting, neapolitan flat 9 in music) for people who've spent so much time on a subject that the basics have become boring.

Oh, and there's also divisions of and patterns for time in music theory. E.g., "hold this note for twice as many milliseconds as the previous one".

There have been some good resources here on HN: https://hn.algolia.com/?query=music%20theory&sort=byPopulari...

That's the gist of music theory as much as "radiation in the order of ~100nm excites your retina and you see colour" is the gist of photography or painting. x) It's the fundamental physical explanation, but there's a world of complexity and subtlety that eludes such a "first principles" explanation.

I agree that to fully appreciate musical qualities, you have to play around with sound and that text alone won't suffice. On the other hand, your description of radiation hitting the retina might be a decent primer on color theory which has about as much to do with photography and painting as music theory has to do with playing an instrument. My goal was to demystify the jargon by showing that it has very tangible definitions which can be understood by even analytical audiences like HN (of which I include myself).

> to fully appreciate musical qualities, you have to play around with sound

@jimbokun: It might be easier for your son to express what he's learning if you can catch while he's got e.g., a piano or guitar at hand. Humans have a hard time generating compound musical waveforms using just their vocal folds (though it can be done to a limited extent as in Mongolian throat singing). Explaining it while playing it will probably also help cement the concepts in his understanding ;) .

This is really easy to follow:


Already learned some things, thanks!

Sorry, but you are way out of your league in trying to explain the "gist" of Music Theory in terms of frequencies. That's so not what Music Theory is about.

This comment would be valuable if it provided some support to the assertion that the original author was wrong.

The problem with the above explanation is that it starts at a lower level of abstraction than is warranted. Analogously, it explains MOSFET's rather than algorithms. The fundamental unit of Music Theory is the Interval (as in "frequency interval between notes"). A better explanation would have explained Intervals, how particular combinations of Intervals form various Scales, and how Scales influence Chord Progressions and Key Signatures.

There are 12 unique notes in an Octave (yes, octave means 8; ignore this for now). On the 13th note, the octave repeats itself (counting is 1-indexed). But of these 12 notes, only specific subsets are combined into specific scales.

The most popular scale is the Major Scale which follows the pattern "Tonic Major_2nd Major_3rd Perfect_4th Perfect_5th Major_6th Major_7th" (there exist other notations). The Major Scale imparts a generically-happy mood. But there's other scales, including: the Chromatic Scale; the Major Scale; 3 varieties of Minor Scales; 7 varieties of Diatonic Modes (including Major and Natural Minor); the Pentatonic Scales; etc. E.g. Smoke on the Water, Sunshine of your Love, and Fight for your Right (to Party) all sound similar because they use the Blues Scale.

Once you familiarize yourself with the intervals, scales, and their various notations (which is its own feat), you can jump into the meat & potatoes of Music Theory. Which mostly consists of analyzing Chord Progressions and Key Signatures in order to find commonalities in mood. Chord Progressions and Key Signatures determine a song's general mood. It's too complicated for me to summarize quickly. But it's where all the interesting stuff happens.

N.B. I've deliberately omitted various details for the sake of brevity. E.g. I could have mentioned Time Signatures, Rhythms, Tempo, Dynamics, etc.

> The fundamental unit of Music Theory is the Interval (as in "frequency interval between notes"). A better explanation would have explained Intervals, how particular combinations of Intervals form

Guess what... A perfect fifth is a 3:2 ratio/interval of frequencies (+/- a small allowance for the historical/mechanical constraints that lead to well/equal tempering unless we're talking modern micro-tonalism in which case no adjustments are necessary). The inverse, 2:3, is a perfect fourth.

The example frequencies I gave correspond to concert-A, then E and D. I took a very simple/short path from intervals to harmonic function/progression to try to give a taste of the meat and potatoes before providing a link to additional sources.

I avoided music theory terms because that would've been a circular definition for any readers who had no understanding of even the basics.

In light of your post, I should've added a sentence or two about mood (major = happy, diminished = tense/scary) and compared that to how you can make a 'warm' picture using reds, oranges and yellows or a sombre picture with darker colors, etc.

"E.g. Smoke on the Water, Sunshine of your Love, and Fight for your Right (to Party) all sound similar because they use the Blues Scale."

Is there a good YouTube video introducing some of these concepts using popular songs?

I didn't learn music through Youtube. So unfortunately, I'm not familiar with any videos that I would consider comprehensive or canonical. At best, I can share videos that highlight a particular pattern, or share examples of popular songs that I recognize as having a commonality. Which might give you a better feel for what music theory is.

Another thing to keep in mind is that musical patterns accrete into genres. And there's a wide variety of genres. So it's difficult for any single video to cover everything in detail. I think it's more common for videos to cover the patterns of a particular genre. E.g. if you're interested in Blues, consider searching for videos about Blues.


https://www.youtube.com/watch?v=xm4LO22-cyY I remember the above Vox video highlights a unique chord which sounds "melty" and is often used in holiday music. The chord is known as a "minor_7th, diminished_5th" aka "m7d5".

https://www.youtube.com/watch?v=5pidokakU4I This video is about the infamous "4-chord pop progression". It's ubiquitous on the radio. Elitists and connoisseurs tend to look down on it for appealing to casuals. The progression is "I V vi IV" (capital denotes major chords, lowercase denotes minor chords).

https://www.youtube.com/watch?v=kfjXp4KTTY8 When I think of the "12-Bar Blues (Chord Progression)", I think of Stevie Ray Vaughn's "Pride and Joy". But there's tons of educational videos on this. It's very popular in not only Blues, but Rock & Roll. It's "I I I I; IV IV I I; V IV I I". But things get interesting here because musicians often substitue "jazzy" chords like Dominant_7th's (aka V^7). For bonus points, look up "tritone" (N.B. Rock is truly the devil's music).

https://www.youtube.com/watch?v=dISEg1ydQoM I'm not actually sure what song I'm thinking of, but there's a particular trope often used in Hollywood films to denote a bullfight. It's based off the Phrygian Mode, which tends to sound very "spanish-y". In lieu, I've linked the the first bullfight track I found.

https://www.youtube.com/watch?v=X4fa44_sq2E A genre I'm particularly fond of is House. Which is often characterized by its "Four on the Floor" drum beat. It's very simple, just continuous quarternotes of kicks. The rhythm is sometimes denoted "1 2 3 4" (where the structure of a single bar is "1 e & a 2 e & a 3 e & a 4 e & a"). The above video is Daft Punk's "Superheros".

And then there's Jazz. Which is hard to explain, because it's the genre where anything goes. And besides jazz, there's lots of other techniques and obscure genres that I can't possibly cover in a single post.


In any case, I'd suggest looking up a particular genre you like and studying it. If you're a musician, learn scales. 90% of pop music these days uses either Major or Natural Minor. But you can really expand your horizons by learning other scales. It's boring, but it builds a strong foundation. Like how a basketball player will run laps rather than shoot freethrows all day.

OK. What is music theory about? The explanation using frequencies, ratios, etc matched my understanding of the underlying physics and their effects on human perception.

"Music Theory" is a very specific term that's used in music studies.

It is mostly a descriptive theory in that it studies musical patterns (rhythm, melody, harmony, intervals, scales, modes, chords and chord progressions) but it can also be prescriptive (for e.g. - don't use certain note intervals in a guitar solo if you are using certain chords in your song)

None of this has anything to do with Physics. Music Theory is completely abstracted from the physical world.

Frequencies : Music Theory :: Logic Gates : Computer Science.

See my other comment.

Well...logic gates are (at a slightly abstracted level) just the reification of some of the logical concepts in computer science. Those concepts could be arrived at by observing the behavior of the gates.

Similarly, it seems like studying the frequencies and their relationships illuminates at least a portion of what music theory covers.

Wow, that's really not what music theory is at all. This kind of eggheaded simpletonism is grossly offensive and embarrasses the HN community, not to mention engineers in general. Please, the world outside of STEM is not reducible to a few hand-wavy sentences about physics.

It's more about the ratios than the example frequencies I provided. That's more apparent if you play an instrument with an exposed string and a finger-board but still true if it's hidden under e.g., the hood of a piano. The definition of consonance versus dissonance is basically whether or not the ratio is simple. The overtone/undertone series from which the various scales are derived is also one only one logical step away. One step past that gets you to diatonic harmony which leads to harmonic progression/retrogression which makes up the bulk of my theory text book and the real gist that I was getting at.

If you can provide a better overview or point out how it's anything more than a bunch of terms/shorthand for sonic patterns, I'd love to be informed.

Don't feel bad about that! My dad didn't know what the hell I was talking about when I was learning C++ as a teenager, but he asked anyway because he saw I got excited about it.

My mom certainly does that for me. I try to explain non-intuitive programming concepts to her with analogies, but I don't think I succeed most of the time. I love her dearly for putting up with it, though.

Wow, more parents should be like that! I'm not a parent, but I try to do the same kind of thing for friends and coworkers in hopes of spreading the idea that others' interests are worth attention and respect even if you don't share them.

If you’re interested in the subject, look up Adam Neely on YouTube. A great channel with a series of 10-minuteish videos on various interesting topics in music, from theory to history to physics and beyond. Not so much a “course” in music theory, morning e of a series of one-off topics mostly accessible by a lay audience. Might be good conversation starters with your son :)

I was replying to another sub-thread here and had another thought:

It might be easier for your son to express what he's learning if you can catch him while he's got e.g., a piano or guitar at hand. Humans have a hard time generating compound musical waveforms using just their bodies/vocal-folds (though it can be done to a limited extent as in Mongolian throat singing). Having him play the sounds as he explains them will probably also help cement the concepts in his own understanding ;) .

>And it gets harder with each kid, at least for me.

That is the most depressing thing I've read in a good while.

Yeah, but I find it's true. I think that's why the first born tends to be, at least historically, the most important child. Because parents spend the most focused attention on them.

If it feels better though, as the youngest of three children, I find I was allowed to wander a bit more, and that has actually proved useful.

Well, when you are not the first, most of the time you end up learning a lot from your brothers/sisters. You are almost always the first for someone in the family.

Then why bother if you're not even trying

One thing that makes this easier is being rich. What I mean by that is for example, when my kid is asking me questions or wants to "do it myself!", the fact that I have a flexible schedule helps immensely, and that flexible schedule is possible because I can turn down work that doesn't give me that flexibility.

If I had a strict clock-in/clock-out job, and only had limited time to run errands, I'd have a lot less patience for waiting for my kid to do stuff or answering her questions.

I consider myself very lucky that I have that privilege and can pass that on to my kids.

Maybe it helps being rich, but just as a counter example, my grandfather was never rich. He was a clock-in/clock-out guy and still managed to spend a lot of time with me while I was growing up. He had a lot more patience than most of the "white collar" adults in my life ever did, and taught me lots of useful skills like how to fix a lot of electrical or mechanical things.

Sure it’s possible to do it when you’re not rich. It’s just a lot easier if you are. Like many things in life. :)

"It's better to be young, rich and healthy than old, sick and poor" is probably not the most novel insight worth writing down for the benefit of others.

I believe the insight that I was sharing is that it matters in this case, as many people would not realize that it is relevant here.

You think 'a lot of things that take time are easier when you have the means to do whatever you want with your time' is something that eludes most people? About anything much, really, be it child rearing or laundry? I think that is very, very unlikely.

My experience as a parent and in talking to other parents says yes, it eludes most anyone I ever talk to about it.

Also the 33 point on the post tell me at least 33 more people found it interesting than did not.

It could well be that you're right and noticing that not having to go to work frees up a lot of time is indeed a counterintuitive and valuable lifehack. It could also be that I'm right and it's an observation made of pure triteonium.

I'm sure we can both agree, though, that the gold standard for statistical significance is 30 Helens. 33 HN users is nowhere close to 30 Helens.

White collar doesn't mean rich. It means never really clocking out because your time is valuable enough it is worth monetizing every minute of it.

We actually made a decision to cut our income considerably in order to be as involved as we can in our kids upbringing - we're basically almost always able to go to school concerts, we always eat together, we practically never aren't with them at bedtime, etc..

It's great. But I think we missed the balance a little - there are so many life experiences that are out of reach that we parents experienced when we were kids. Yes being tight with our kids is awesome - but when they get old enough to spread their wings a little, and when they're inquisitive about new things, then supporting that is exceedingly difficult when you're of low means.

School skiing trip? Not a chance, way out of our price bracket. Holiday abroad? Same, the interest is there, they're keen to learn geography/languages/culture. Piano lessons? Same, we've got a keyboard, one child is really keen and show some ability but we don't have means to support him in that and let him find fulfilment through that creativity.

But I do get to talk Fibonacci series; build fires in the woods; teach them about how aliens with 0, 4, 16 fingers count; but buy an up to date globe, or take them for a train ride, or go on a boat, or have a pet, or visit a mountain, ...

My problem is not time so much, nor fostering inquisition, but resources to develop the questioning in to solid foundations. Our kids are not the free-spirits of knowledge-hunger we anticipated because we instead have to follow economics.

It's not "being rich" that helps, it's having a high hourly rate of pay relative to expenses. Many rich people work 60+ hr weeks with travel, and don't see their kids much. Many non-rich people are stay-at-home parents or extended family. Of course, they can hire nannies, governors, and tutors to fill in the gaps...

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.

Out of curiosity, did you mean you have eight kids, or your kid is eight years old?

Because if it's the former, I'm impressed you have even one second to be on HN!

It's the former!

If you do have 8 kids, that's amazing. I have 5 myself and most of the time I feel more like a zookeeper/riot policeman than a dad.

Economies of scale. The kids work together, play together, teach each other, and parents facilitate (often leading to interesting conversations like the one in the article). It's actually probably a little easier than having 5.

A coworker keeps telling me (I'm a parent of one, and intend to stay that way) that having a big family like his is easier, since the older kids can take care of the younger kids.

Which sounds totally plausible and correct, 'cept it'll take you awhile to get up to that sort of economy of scale :P

This being Hacker News, we can talk about it in terms of graphs, right? Let's look at the sociogram when one parent is present.

The transition from zero to one is of course world-changing. But at one child, 100% of the connections in the sociogram connect to a given parent: zero economy of scale.

At two children they have each other, but that is only 1/3 of the children's connections when one parent is present.

At three, we're up to 50% of the connections that are child-to-child. At this point the sociogram is rich enough to become interesting.

Four => 60%. Eight => 77.8%.

> At this point the sociogram is rich enough to become interesting.

But the family is poor enough to become boring!

(I can't resist a good pun.)

Anyway, kids aren't raised in isolation with their parents. Our two year old tot already has two kids that I would consider her friends; she mentions them when she's home, and she prefers spending time with them to spending time with other kids.

Ask any member of a large, poor family whether they would trade (life improvement costing $XX,XXX) for having fewer children in the family. Life is beautiful and easily beats filthy lucre. It's worth the struggle. People lose sight of this.

Sure. Can I ask the how many more kids they plan on having? Can I ask you the same question? Can I ask why that number is less than 16?

I spot two assumptions in your comment: 1) that families plan the number of children they have, and 2) that this planned number is some number lower than 16.

Yours is not the only worldview.

And with birth rates plunging worldwide, many now trending below sustainable levels, who will provide you with healthcare and other services in old age?

How fun that must be to take care of siblings, wow, youth enjoyed for sure.

Yes, of course, having younger siblings is exactly the same as being a full-time live-in babysitter.

Did you know older siblings don't even get paid for the work they do?

It's not wrong, but it's a real dick move toward the older kids.

It can be done that way, but there are alternatives. One family I know, the kids actually sometimes quarrel to be allowed to take care of the youngers. In our family, we have "chore points" that are mutually negotiated, and babysitting is a favorite way to get one's points racked up easily.

And, kids are fascinating conversationalists

My wife recently put up a small message board in our kitchen, where you can press letters into fabric to say what you want. My daughter (5 years old), suggested, "Candy inside your heart." I find the sentiment very sweet. We have not broached free monads yet.

Honestly, would you need free monads if you already had (the feeling of) candy inside your heart?

Maybe we need to look at our priorities.

As a parent, I agree. One should not shy away from talking about "advanced" topics. Kids are naturally curious and bright and I think we should encourage their desire to learn and understand complex things.

I worry that if you try to dumb down things for kids, they might become interested in dumb things. :)

Also, as the OP mentions, it can be a fun "pedagogical challenge" to try to explain free theorems or turing completeness or MySQL sharding to a young child. And you may find a clever way to describe it, that they can easily understand, which is satisfying for both of you.

When my daughter was 10 we were waiting in line to checkout at a Home Depot. She asked me what was algebra. I think she had heard the older kids mention it. I responded with a question. "A plus B = 10, and A minus B = 1. What are the values of A and B?" She puzzled it over while I check out. Then her face lit up like a whole realm of knowledge had just opened up to her, and she proudly told me the answer. It's a special moment that we will both always remember. She told me that as a camp counselor that she has challenged younger kids who seemed bored with the same problem.

Do challenge your kids intellectually beyond their years and you might be pleasantly surprised. My daughter heads to CERN in two weeks to study anti-matter, and I have no doubt that our brief intro to algebra at a Home Depot has a small role to play in that journey. Maybe Star Trek did too :)

As someone who takes pride in having solved the first 100 problems of project Euler, I am slightly ashamed to admit that I probably spent as much time as your daughter to solve that.

I got stuck thinking in integers, and quite quickly left the exercise as an oversight in writing the post (since X + y = even, X - y = odd is impossible for integers)

3 seconds into the first coffee of the day the realisation of my stupidity hit me in the face.

It's impossible until it's easy, like any good trick question.

For the posterity: {a+b=10;a-b=1} translates to {a+b=10;a=b +1}, thus the first equation is ((b+1)+b=10) giving (b=4.5), and from there we get (a=5.5).

Another fun way: add the two equations to get 2A=11 and subtract to get 2B=9.

I mean, is there any other solution? There are certainly no integral solutions to the problem, but there is a unique (rational) solution.

I feel like I’m missing something entirely, though...

I was also stuck thinking in integers for a few seconds, perhaps because of the context. But yeah, a 10-year-old would already know about fractions.

I also mentally started thinking about integral solutions. I wonder if it's also because of the variable names... a,b,c tend to be used to represent integers (e.g. Fermat's Last Theorem, Euclid's algorithm etc).

x and y are more commmonly used to represent real numbers.

Random aside: once in high school I took a math puzzle test. The only problem I skipped was because they asked for "integral solutions." I knew the word "integral" only as belonging to calculus, about which I knew nearly nothing at the time. If I had realized in context it just meant "integer" I could have done it!

They did make it a tricky question!

Thanks for pointing that out. I'll use X and Y next time I share this story. Of course my daughter wouldn't have known at the time about the distinction, and neither did I - it having been too long since doing algebra ;)

Coincidentally a friend at University had a dad who worked at CERN. His number one goal was to not work at CERN.

Do you know why?

(My guess)

She spent her teens trying to get away from dad, why spend her working life there? :)

I'm not totally sure why. The life living on the boarder between France and Switzerland seems pretty idyllic (but at the end of university you don't think about that so much). I got the feeling it was just that going to work where your dad is isn't very appealing no matter where it is.

I have three very inquisitive kids and I love trying to explain complex topics, like reinforcement learning, to them in a way that they can understand. The best thing I get out of it is clarity for my own understanding, or gaps/lack of clarity, so it's a valuable exercise.

People don't give children enough credit for what they can really understand.

I remember distinctly teaching my oldest daughter how to do a basic cipher - like direct substitution and she got it immediately. I also taught my son how to do pin bumping and pin counting/picking on locks with my lockpick set. I even bought him a transparent set of master locks to practice on and he would sit for an hour at the age of 4 picking those locks. The obvious downside now is that he knows how to get into everything!

Very cool to watch what are basic principals being applied at the very basic level.

Exactly. My 4 year old sometimes surprises me like that. Last week she asked me how you can talk into a mobile phone. So I said, there's a tiny transmitter in there, and it sends the voice over waves in the air. So she's like, "OK" and I thought it went over her head.

Then yesterday she asked: "Why couldn't you call gramps when we were on the plane?" I told her that the mobile phone wasn't close enough to the receivers on the ground.

It amazed me that obviously some facts had been stewing for a week in that tiny head. And out comes another question.

When my mother died, I was asked to think of one word to describe her. The best word that I could come up with was "teacher." One quick example: when my own child was 2 or 3, we spent some time with Grandma at Yellowstone National Park. Grandma walked with her grandchild through the park and explained geisers, plate techtonics, and many other topics of geology. I rolled my eyes and thought, "Really? He can barely speak and you are delivering a college lecture?" But then I remembered all the college lectures of my own youth. It's amazing how much even the youngest minds can absorb.

One of my biggest failings as a parent has been to assume that my children will learn things somehow without me teaching it to them. If anybody learned 1/3 of what my mother taught them in detail, they learned a lot.

Related, "Math from Three to Seven" by Alexander Zvonkin[1] is an excellent book on discussing math with young kids.

[1] https://bookstore.ams.org/mcl-5/


I have not read this, but it's from the same person who helped create "anchor modeling" and I find that quite interesting.

From the "Look Inside", it strangely pairs very "childish" pictures with small-font densely-packed pages high-school or college-level mathematical prose.

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.

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.

No, he asked "What are you reading?" and followed up with the question “What are free theorems?”

The kid was crying out for a math education!

On a serious note, you may be right in that it's a simple call for attention, but at least with my kids those are the opportunities for the best instruction, because the kid is usually bored, curious, and wants attention. If you give said attention, and answer questions in a way that they can think through and reason about, they will grok stuff you never expected.

Yes, those are equally suitable choices as you say. Why are you implying that stopping to play frisbee would have been the more "equally suitable" choice in this situation?

Who's to say you can't talk about functional programming while playing frisbee? Who's to say that 9/10 times the kid gets some rough housing when he asks?

And much more likely: who's to say that the overstimulated little monster that asked 15 questions in 5 minutes doesn't need a little dose of adult life to encourage some self-play?

The kid got the attention and some more. How would frisbee be any better?


I'm a father of two girls, ages four and nine.

Explaining things to them and seeing the dawn of understanding in their eyes in easily my greatest joy in life. As a parent, I basically get to relive this xkcd[0], over and over, every day.

We take it to an extreme - we unschool[1]. We do our best to treat our daughters as any other member of the family, expecting to act as adults to the extent that they're able to do so. My nine-year-old spends much of her days right now playing Roblox and Star Stable, but even that is punctuated by her coming to us with random questions about things she's interested in. If I'm not head-down on a project I take the time to explain as best I can. If I'm otherwise occupied I always at least take the time to say "Go search for <insert keywords>" and follow up with once I'm free.

The results have, so far, been incredible. Our oldest was a late reader by the standards of the testing done in government schools, but once she ran into something she wanted to do that could only be accomplished by reading, she achieved fluency more quickly than I would have ever expected. For what it's worth, that "something" was an online RPG where she had to do quests to progress. In order to do that, she had to be able to read the quest text.

These days she's engrossed in the "Pegasus" series by Kate O'Hearn, and devouring them at a rate of ~1k pages per week. She'll have finished the series by the end of this week and I'm hoping she'll pick up Asimov's "Norby" series next. If not, she'll find something else that interests her and continue reading well into the wee hours of the morning I'm sure.

0: https://www.xkcd.com/1053/ 1: https://en.wikipedia.org/wiki/Unschooling

My problem is unschooling is that just because you’re not interested in something (as a kid) doesn’t mean you shouldn’t learn it.

It’d be nice if traditional school had a better balance where personal interests could be explored in a structured and formally accepted way.

> My problem is unschooling is that just because you’re not interested in something (as a kid) doesn’t mean you shouldn’t learn it.

In my experience as an unschooled child who was in constant contact with the parents of other unschooled children, and other unschooled children, if a child isn't interested in something, that almost always changes over time. One example was where one kid did not wish to learn to read, until about the age of seven where he taught himself to read, without much struggle (and without parental intervention -- the parent found out about it because the kid kept the books under his pillow!), simply because he found a topic he was so interested in that he wanted to learn more about it.

I also know someone else who did not learn to read until the age of 6 or 7, after which he rapidly caught up, and at the age of 9 or 10 he sped through all three of the Lord of the Rings series, and was an avid reader. These are only two examples of something that was typical within unschooling circles.

One fundamental idea behind unschooling is that children develop at different rates, and thus in some cases, trying to force them to learn something before they are ready to learn can actually cause damage -- in a lot of cases this damage isn't visible, but that doesn't mean that it isn't there. I experienced this first hand, with a primary school maths teacher. This mathematics teacher misexplained things, and would constantly pile on the stress. It took me 6 years of unschooling to de-stress enough with regards to mathematics enough to simply add up efficiently (it felt like punching through a mental brick wall, I was completely unable to manipulate the numbers, despite being able to see them). Now at the age of 20 I am still filling in gaps in my mathematics education, through the right aids.

Something I would add is that most people learn the skills that are required for them in day-to-day life, so even if a child is not interested in mathematics, they tend to learn the basics just by helping out their parents with shopping. The most important thing that a child needs in their life is the willingness to learn, which is a skill that school rips out of our children.

This sounds great! I remember teaching myself to read before I was supposed to (very standard Belgian education), and probably as a result I was from that point on always ahead of my classmates simply because I'm very curious. I tended to read ahead for subjects that interested me, and not really bother for those that didn't. Teachers were sometimes annoyed because they really didn't understand why I could do insanely well for some subjects (or even some parts of some subjects) and do absolutely horrible for others, with no reasonable explanation for it. Especially as soon as I discovered computers and the internet, things changed rapidly as I was learning how to do things (and even program some PHP and create websites with Dreamweaver). You could basically say I unschooled myself almost right up until I finished our equivalent of high school (at 18).

And then I was royally screwed. I always had enough grades for teachers to pass me on almost all subjects, but in my last year of high school I was really stressed out about what I wanted to do at university, and stopped making an effort for a lot of subjects at high school that were suddenly going at a pace I couldn't follow in "zero interest mode". It took me two years and a detour via a central government exam to get my degree.

Then I was screwed again in my final year of university college (software development). While I did great in the actual software development courses, I couldn't get myself focused on subjects I didn't care about (because I never had to, so I had absolutely no study methods for things that don't interest me). So of course after three years when I should've had my degree, I had nothing. Even though I had been to all classes and seen everything, on some subjects I just didn't pass because they didn't interest me at all.

So I just quit and started working, which was absolutely fine. I found enough at work that interested me and I became a pretty decent developer in no time. 26 now and I'm still coding cool stuff, so I'd say it ended well.

Based on how my education went I'd say unschooling would've been a great fit, but I really wonder if an unschooled kid would be more or less likely to encounter the same problems I have. While for programming you can easily get your professional life going without a sign of a degree, for many fields that's not a possibility and you will have to study (a lot). If you've never _really_ had to just process and memorize things that don't interest you, that might get really hard. I fear that being unschooled might be great at the start, but there's a point where (for most fields) you have no choice besides going into a classic education system, and you'd be less prepared than other students...

Would you say that not getting the degree was justified, since getting a degree is 50% the display of having the intellect to the subject and 50% the display of having the diligence, persistence and discipline to finish something, which is one of the most important traits in the professional world.

Not trying to be snarky, but genuinely interested.

Did the "inability" to focus on things you're not interested in impede you later in life, e.g. with taxes, social life, exercise etc?

Absolutely, not getting the degree was justified. I also believe that in some fields (software development) a degree isn't really necessary, and I'm glad most employers see the value in experience and willingness to learn.

Taxes and administration: not that complex in Belgium so I can't say much about that, but I value correctness a lot and that makes my administration easy to do (I never ever postpone doing my taxes, paying bills, ...). I usually find a way to make things interesting too, by keeping my administration as digital as I can. I'm always an early adopter.

Exercise: I struggle with this. Once I get going it usually goes quite well (but always have to combine it with something that does interest me, for example running with "Zombies, Run!", a sort of interactive audiobook/running trainer combination), but tend to stop completely if I hit roadblocks.

Social life: maybe. I have a great core group of friends that I've known since high school but that's about it, and I am not great at forming deep bonds. I have some work friends, but not at the level that I'd invite them over for dinner on a random week night. It's not at all at a problematic level though. I don't really know. I tend to be extremely honest and open about basically everything, and that scares / freaks out a lot of people, so it's not easy to make new good friends.

If you want to chat more, feel free to message me on whatever messaging platform you like. My username is always Ambroos or AmbroosV.

7 isn't really that late for reading. Lot's of well respected schoolin systems don't even attempt to teach reading until 7.

> 7 isn't really that late for reading. Lot's of well respected schoolin systems don't even attempt to teach reading until 7.

This is very interesting to me. I come from the UK, and the government's attitude to education is contrary to all of the pilot schemes, studies, and research I've seen. Namely they seem to have warmed their heads with the idea that the only way to advance learning is to put the student into the education system earlier and earlier. Rather than waiting until later (when they are ready), and improving material concerns so that good nutritional health from birth onwards is available to everyone.

> My problem is unschooling is that just because you’re not interested in something (as a kid) doesn’t mean you shouldn’t learn it.

I was initially concerned about this as well, but my experience so far is that it's not really an issue. We test regularly, both formally and informally, which I feel is very important so my wife and I have a good understanding of where she is relative to her peers. With the exception of the "sight words" portion of language testing in K-3, she has continues to be far ahead of them.

"Child-directed" doesn't mean "no parental involvement". Where a traditional school manages the things that she would be taught, we manage the things that she's interested in. We take care to do things as a family that expose her to skills that we think she needs to know.

If that sounds time-intensive... well, it is. My wife doesn't work outside the home and I work remotely. It's substantially less time-intensive than building a traditional curriculum and teaching it daily, though.

Huh, that's the first time I've heard of unschooling, it seems like a really cool concept. If you don't mind me asking, where do you live and what are the laws like around unschooling there? How are people's reactions?

We're in Arkansas now, having moved from Virginia at the end of last year.

Virginia requires a Notice of Intent to be filed with the local school district and periodic standardized testing - there are some way around each of these things, but that's the course that the vast majority of homeschoolers take. It's annoying but not onerous.

Arkansas basically requires nothing at all.

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

Interesting quote.

It's fun to talk to kids! Many of them are way more curious than most people are.

And it is endlessly entertaining to see just how quickly their minds can wrap around a subject you would think is too advanced for them. Its a matter of establishing a common language. Seeing that light go on in their eyes is unbelievably satisfying.

>\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.

I have a series of programming assignments in my introductory course that has students write simple functions in Python. One of those functions is to consume nothing and returns their (the programmer's) current age. So for example, you might write

    def get_my_age():
        return 21
The students' reaction to this in office hours can be... interesting. I am curious how many of them actually follow the comment at the bottom of the question, and what they think:

> Reflect on the difference between creating a variable with a constant value and creating a function with no arguments and a constant return value.

Up to you to decide if this has any pedagogical value. The real learning objective was to "write a function that has no arguments but returns a constant value", so getting them to draw big conclusions about the nature of functions and values and so on is outside the scope of this little activity.

One of those functions is to consume nothing and returns their (the programmer's) current age.

This is - or at least might be - ambiguous. Current age as of implementation time or current age as of function invocation time? And while a result in whole years is a pretty natural and obvious choice for the age of a person in absence of an explicit requirement, it is certainly not the only sensible choice.

I'd argue it's not ambiguous: current age would have to be a function of invocation time, while "age at time of writing the function" would be a constant.

Expressing "age" in whole years is acceptable in English, but using a decimal would be highly defensible. That's an issue of grading though.

Yea, that would have stumped me, expecting a trick/trap. What if my birthday is tomorrow? By the time my teacher checks it, it's wrong. "Your birth year" would have prevented that.

This is a problem I have with certain parts of computer science and math education. Everything is encouraged to be exact, then, suddenly, variable names are used inconsistently, niche cases are ignored arbitrarily and explained with essentially referring to "common sense".

It's graded immediately (automatically), so there wouldn't be any issues. Further, the text of the problem makes it clear that I'm not actually going to check their age - they can return any valid number (although it does check >0 and <100, perhaps discriminatorily). It would be a little invasive to their privacy otherwise, I think.

Isn't that more or less what happens in the real world?

Software engineering is all about mapping dirty nuance to formal systems.

But general purpose education isn’t „the real world“. I think the opposite argument is often made to justify teaching theory when it doesn’t seem to have many real world applications.

If we were talking about pure functions, I would certainly agree, but in Python it would of course be perfectly fine and not unusual to have an impure function implicitly depending on the current time. Obviously assuming »consume nothing« only refers to the parameters of the function, so this too could be less ambiguous.

That section reminded me of how constants are implemented via functions in Perl e.g.

  use constant PI => 4 * atan2(1, 1);
under the hood becomes

  sub PI () { 4 * atan2 1, 1 }

What I find surprising is how easy it is to understand functions as being made up of other functions (+), as opposed to functions that are not (constant functions).

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?

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.

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.

Not all linear functions possess a Taylor expansion, as not all linear functions are continuous, example: https://en.wikipedia.org/wiki/Discontinuous_linear_map

But, your statement is true for all real-valued linear functions AFAIK.

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

That is a badly written article. And the ones for linear map and continuity linked there, which would be important to the topic, too. The good mathematical articles start with a definition after the intro.

So much for teaching year olds. This is not rocket science, but mathematicians (almost inherent) inability to have language skills makes it seem so, notably.

This makes sense, but I don't see how it explains the difficulty the kid was having.

6+a*x, a->0

same but different:

6+x/a, a->infinity

imho constant is a special case of linear

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

Oddly, I think I'm stuck on the idea that it has to be "just once." Curious if the child could have figured out a function that needed the input twice, as an example. (So, x^2+x, or something similar.)

So, is it that it is linearly typed, or that it is greedy and wants to use all inputs given at least once?

Or, are those the same thing?

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 function that multiplies by 2 is intuitively ok, what's wrong with a function that multiplies by 0?

>what's wrong with a function that multiplies by 0?

Obviously the fact that it doesn't seem to have any visible effect on the input -- and people expect the input to be affected.

I think it's more that it doesn't make use of its input. If you aren't using the input, why is the input in its type signature?

Affected? f(x) = 6 has a pretty obvious effect on all input other than 6.

Your comment is more of an indictment of identity functions than dimension-losing functions.

A phrasing more to the point is that one expects the input to have some effect on the output. One usually obtains this by, colloquially speaking, performing actions on the input, since if you don't act upon the input in some way, you're going to get a constant result. Of course, you are correct in that some actions don't really do anything, but they're observationally indistinguishable from not acting on the input in the first place.

Your comment seems confused in exactly the same way as coldtea's. How are you imagining turning input 20 into output 6 without acting on the input?

If you don't act on the input, you have an identity function, not a constant function. Constant functions must alter their input whenever it doesn't match the constant output. Nobody ever complained that the problem with Procrustes was that he didn't do anything to the guests in his bed.

And in the other direction, I don't understand why you want to characterize "multiply the input by zero" as an action that "doesn't do anything"? In what sense would that be true?

>Your comment seems confused in exactly the same way as coldtea's. How are you imagining turning input 20 into output 6 without acting on the input?


f(x) = 20

No action on the input -- discarding the input is not an intuitive action for a 6-year old that just got a handful of of ax+k and xk + n style examples.

>Nobody ever complained that the problem with Procrustes was that he didn't do anything to the guests in his bed.*

You seem confused. Procrustes operated on his guests, which is neither the identity (they would come of unscratched) or the constant function (in which the same person or thing would emerge out of the bed).

Their height in the end was the same, but that's not the argument to the Procrustes function -- their overall body was.

>And in the other direction, I don't understand why you want to characterize "multiply the input by zero" as an action that "doesn't do anything"? In what sense would that be true?

Obviously in the intuitive sense for a 6-year old -- which is what we're discussing, and which was based on some operation on the argument that resulted in a different value each time, not degenerate versions of functions like the identity, constant, 0, etc.

(That said, it "doesn't do anything to the input" in the sense that it's not dependent on the particular input. 2x gives you 4 and 10 if you pass 2 and 5. 0x gives you 0 whatever you pass it, so could just as well be a constant fx = 0).

> f(x) = 6

Fixed, for the sake of corresponding more exactly with the challenge. Not that it wasn't clear what you meant :)

Yep, that!

A constant function doesn't act on its input. `f(x) = 6` doesn't perform a different action on each input. But given your comparison to `f(x) = 0*x + 6`, let's move away from numbers and consider a different function. `f'` which I'll define as:

    const :: a -> b -> a
    const a _ = a
    f' :: a -> ()
    f' = const ()
Now I can give `f'` anything at all. Can you try to explain the action of `f'` in any way but that it ignores its argument?

Functions don't alter anything. 20 is still 20 even after you evaluate f(20) to be 6.

That's where linear logic differs, if you will. The highest voted comment in this sub-thread already alluded to that.

I'm a big fan of linear typing but I think of it as more like "consuming" the input than "changing" it.

>Affected? f(x) = 6 has a pretty obvious effect on all input other than 6.

It wasn't "what would the result be" that eluded the child (or those students).

It was the question "in what way is this an operation on x" -- which in their minds was intuitively, put x in and add/subtract/multiply by something(s) to get another result.

fx=K, fx=0, or fx=x didn't seem as substantial enough transformations (given the other examples) to qualify with their notion of a function.

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

"Trivially easy" to a six-year old? Who may or may not even have a good grasp of the concept of zero yet? You don't seem to be very self-aware of the extent of your knowledge and understanding compared to a preschooler.

I think the problem is that our intuition is more or less based on a mechanical world in which the concept of a side-effect free or ineffective input is foreign.

I suspect it's more that our intuition is that everything is meaningful, or at least something is, so when the solution to is to ignore the only thing you have at hand, it's hidden in plain sight.

This goes so far that the phrase "nobody knows" is described by grammarians as having a zero pronoun, ie. "nobody knows (it)". "it" doesn't need to be specified, because nobody would know what it is, and so nobody cares. Correspondingly, functional programmers use to write "f(_)" and in prolog for example that acts as a catch all glob operator, if I recall correctly, not sure about Haskell.


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 [EDIT: now also at https://drive.google.com/open?id=1hfzm3Rvm4xpwp_xHUKBHxuIEgf...]

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.

This is fantastic, good job!

I'm currently teaching an introductory programming course using Python (for people who have never programmed), and the level of abstraction you are using in your worksheets inspired me to actually update the exercises on my worksheets I'm using for the course (e.g. break down concepts even further and use more repetitive tasks to actually help students get the hang of these concepts).

Thanks a lot for sharing your ideas!

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

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

Thank you!

Scribd is the worst thing on the internet. Please stop using it.

Thanks! I think my 6yo would like doing these (though he doesn't have a strong grasp of multiplication/division yet).

This is super fun and such good timing! Thanks for sharing this.

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?!?

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

Very true, and I did actually explain that to him. In my rush to tell a good story I left out the pedantic part.

We'll forgive you - this time. ;)

The original is correct, it says "apples" not "apple(s)".

Indeed it says "apples" and "buckets".

[Now, why op didn't use pidgins and pidgin holes, I'll never know... ;-) ]

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.

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.

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.

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

Music academics who envy scientists or engineers have a misplaced envy. They should properly envy those who fill concert halls and sell records. Just as does many a scientist or engineer who plays some instrument on the side.

And at least two buckets.

FWIW, "rectangles" is a visually/geometrically natural way to express "buckets of equal size".

And "1xN doesn't count" can be expressed nicely as "it can't just be a line", or "the line must be folded up into a shorter rectangle [because more compact shapes are nicer]"

> Who knew?!?

Your six year old came up with a new recursive prime generator over the course of a conversation introducing him to the concept of primes, and then submitted this as a paper to arXiv? Do you have a link to this paper on arXiv?

> Do you have a link to this paper on arXiv?

This part was sarcasm.

It was a strange context switch if it was sarcasm...

It was self-deprecating humor aimed at acknowledging that all parents are pretty sure their children are the smartest humans to have ever walked the earth.

At least that was my reading and it gave me a chuckle.

My apologies, I was just slow on the uptake, and this being HN, although I was incredulous, I was also fully prepared for you to come back with a link!

I get the joke, now that I know it was a joke. You never know who's on the other side of the wire, and for all I know you might have some genius kid. My 5 year old is into Nerf guns and Mario, but again, this _is_ HN...

Anyway, I'll take my downvotes and move on. Thanks for sharing the story, I might try explaining it like this to my kids!

Edit: oops thought I was replying to jawns

Basically an "apple falling on Newton's head = discovered gravity" kind of story people eat up about invention and science. Which always seems to gloss over the endless hard work and constant failure and self-doubt they went through. Plus the incidental ancillary work done in related fields which helped spawn the initial seeds.

Although there may be a useful metaphor here that the solutions are often easier or more "obvious" than they seem, and people often get lost in the details and busywork, missing the forest for the trees. So having a simple (but receptive) wall to bounce ideas off of (such as a 6yr old) helps break through the noise to focus on core / fundamental / primitive ideas from which more complex breakthroughs spawn.

This game can be played in a group, too: 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.

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.

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?

If anyone wants to try, I wrote a small game like this. Input is 3 (ordered) digits, output is a Boolean. http://laurent.le-brun.eu/games/rules/

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.

I for one really like reading about Alice and Bob. Amongst other benefits, it helps me consider how, even if currently just a theoretical algorithm, that particular protocol could end up being used in real world communications.

Yeah, it adds time to the equation :)

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/

(A)lice and (B)ob set up a channel. (E)ve is an evesdropper.

When the only thing you change is to personify A, B, and E in your narrative description of a logical protocol, you are not making an analogy or an abstraction.

Sequence diagrams, BAN logic, UML, pseudo code and other protocol notations are not teaching analogies, they are specifications. Some more useful than others.

Teaching analogies and abstractions are more of a mix of use cases, literally analogous functional relationships, black boxing, edge cases and boundary conditions. The "why" behind the "how."

That Alice and Bob can be replaced in every situation with (A) and (B) means they are not abstractions or analogies, and are therefore patronizing cartoons that obfuscate useful information.

Alice and Bob aren't just A and B. A and B are members of the category of "things" Alice and Bob are members of the category of "communicating entities", and are also familiar names for human. Humans communicate, so choosing Alice and Bob makes an analogy that helps the learner remember that A and B are the communicating entities, not messages, or the encryption key, or anything else.

They are illustrative examples that help with visualization and connecting the theory to an interesting use-case, which taps into most humans' natural preference visualization, socialization, and relevance. They aren't patronizing, they are humanizing.

Do you also feel that speaking in English is a "patronizing" way to communicate, since everything you say could be expressed in mathematical symbols?

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

That's a more complex idea that requires a more complex model. For example, Alice and Bob change to mailboxes, and Alice can have multiple mailboxes and mail stuff to herself.

What about it? Why should it be treated differently?

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

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.

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


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

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.

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.

I never said precocious necessarily meant anything. And there's a reason I used the conjunctive "and" in "abnormalities and handicapped general intelligence", though I could have worded it better.

And I never said "early reader", I said "independently ... too early". Both qualifiers were intentional and important; in particular, I very much intended "too" to be non-specific.

And you're wrong about behaviors like hyperlexia, and wrong precisely in a way that proves my point. Hyperlexia also strongly correlates with obsessions with letters and numbers, but they're distinct phenomena. The latter is an even stronger indicator of autism, but many times hyperlexia is what both parents and others will take notice of first. (Which is a very important point--for this and other reasons, a young child that is both hyperlexic and shows obsessive traits, only the former is likely to be discussed in anecdotes about children with surprising abilities.)

My whole point was that for many of the examples and anecdotes you stumble across on the internet and in discussion, especially the more extreme ones, keep in mind that the children may have other, debilitating developmental abnormalities. Of course, it would be better if these stories received little or no interest or if people didn't naturally internalize these anecdotes in a way that leads to anxiety in their personal lives; but that's not how the majority of people naturally behave.

Regarding the alleged condescension, I possess professionally diagnosed traits that make me "gifted" in many senses of that word, including the euphemistic sense. What I find condescending is how people use "gifted" to elide the complex reality, rather than to put in the effort to discuss things in more concrete terms (i.e. with greater specificity and context), which is really the only way to both avoid prejudice and misunderstanding while being honest and respectful.

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.

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.

I mean... honestly, understanding functions is not overly difficult. The only reason we don't expect children to understand them is because we don't teach it to them. On the other hand, we teach them bizarrely detailed and extensive algorithms for doing all sorts of computations on the rational numbers, and expect them to be able to do them perfectly.

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.

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

> “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.

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

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.


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?

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

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.

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.

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.

This sounds a lot like the card game "New Eleusis": http://www.logicmazes.com/games/eleusis/index.html http://matuszek.org/eleusis2.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.)

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?

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

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

In Belgium the Steiner school is free

My informed but non-professional understanding is that: the good news is if your kids are biologically your own and you are naturally curious, they are predisposed to be as well. The bad news is that studies show that if you want to steer them towards being more or less that way through parenting style it is not going to have any long term effect. [0] I came to this understanding (which, I'm aware, is pretty different from the public's understanding of child-rearing) from reading, among other things, The Nurture Assumption and the chapter on children in The Blank Slate.

[0] That's not to say that there's no correlation in the real world between parents trying to steer their kid to be more curious and the kid growing up to be more curious, just that there's no causation because both effects are caused by their shared genes.

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.

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 ?

I don't think state is the problem. I think the visibility of state is a problem. In most programming, state is some nebulous thing that you really only get to see in a debugger. Otherwise, you're left reasoning about what you think the states are and can be. How many bugs trace down to statements like, "This data shouldn't be here."

That's why Excel works for so many people -- the internal and intermediate states can be as visible as the user needs or desires them to be. And those users seem to have no problem chaining together multiple cells into what is essentially a very complex function.

It already exists, MS Excel

Yes: Joy.


(Shameless plug for my own implementation: http://joypy.osdn.io/)

Can you please explain why Joy is simple to a non-programmer ? because all i see is verbose language, and i know some programming.

> Can you please explain why Joy is simple to a non-programmer ?

I don't know, but I'll try.

It's simple, small, and fun.

First, everything about it is simpler than most other languages. (It may be the simplest useful language, e.g. "Brainf*ck" is simpler but impractical.)

Second, there are many small basis sets of functions that provide Turing-completeness. Meaning that you only have to master a few functions to be able to build any possible function.

Third, developing code in Joy is very like a simple puzzle-solving game, it's very fun.

I may be teaching it to non-programmers in a kind of seminar or course soon, so if you are really interested in real-world data please check back on the Thun site in a month or two. Feel free to get in contact with me through that site as well.

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


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.

I actually really like the look of that. One of my friends is learning to program (in Python) and has recently taken an interest in FP. Planning to show this to her.

Lisp is perfectly suited for this task due to the minimal and familiar syntax to non-programmers. Math should be taught in prefix notation if u ask me.

Familiar? Seriously?!? That syntax is not familiar to non-programmers.

> Math should be taught in prefix notation if u ask me.

Perhaps it should, but it's not.

Or was this whole post sarcasm, and it was done so well that I missed it?

There must be a name for that, when someone casually says something is simple when it is in fact a very complicated subject.

EDIT: After some googling, TIL humblebragging.

Well, hopefully nobody ever asks you!

Almost anything in the End User Development research field.

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

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.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact