29 ms·
Conversations with a six-year-old on functional programming
- deaps 9y agoI enjoyed it. I spend a lot of time listening to people ramble in meetings or troubleshooting, where I wish they understood the subject matter enough to explain it as if talking to a six year old.
- ummonk 9y ago>\lambda x.\, 6 was also surprisingly difficult for him to guess (though he did get it right eventually). I think he was just stuck on the idea of the function doing something arithmetical to the input, and was having trouble coming up with some sort of arithmetic procedure which would result in 6 no matter what you put in! It simply hadn’t occurred to him that the machine might not care about the input. (Interestingly, many students in my functional programming class this semester were also confused by constant functions when we were learning about the lambda calculus; they really wanted to substitute the input somewhere and were upset/confused by the fact that the bound variable did not occur in the body at all!) Just goes to show, our intuition works on linear types.
- taeric 9y agoI'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?
- darkkindness 9y agoThe child was stuck on the intuition that the argument must change in some way (i.e. that the function was linearly typed).
- thaumasiotes 9y agoThis 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?
- jdmichal 9y agoI 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
- coldtea 9y ago>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.
- thaumasiotes 9y agoAffected? 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.
- Twisol 9y agoA 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.
- 9y ago
- taeric 9y agoOddly, 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?
- jackpirate 9y agoA 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.
- snissn 9y ago6+a*x, a->0 same but different: 6+x/a, a->infinity imho constant is a special case of linear
- judofyr 9y agoWell, a linear function is a function where you can only use the parameter once when expressed in its Taylor expansion. E.g. these are not linear: x^2=x*x (used twice), exp(x)=1+x+... (used infinite times). It’s a very symbolic way of thinking about it though, and not what you usually consider an important property of linearity.
- RaitoBezarius 9y agoNot all linear functions possess a Taylor expansion, as not all linear functions are continuous, example: https://en.wikipedia.org/wiki/Discontinuous_linear_map https://en.wikipedia.org/wiki/Discontinuous_linear_map But, your statement is true for all real-valued linear functions AFAIK.
- ginnungagap 9y agoYou 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
- posterboy 8y agoThat 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.
- omeid2 9y agoI 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.
- gowld 9y agoI 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.
- posterboy 8y agoThis 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.
- acbart 9y agoI 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.
- danbruc 9y agoOne 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.
- bonesss 9y agoI'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.
- danbruc 9y agoIf 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.
- arunix 9y agoThat 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 } http://perldoc.perl.org/constant.html#TECHNICAL-NOTES http://perldoc.perl.org/constant.html#TECHNICAL-NOTES
- deleted 8y ago[deleted]
- thomastjeffery 8y agoWhat 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).
- dyladan 9y agoWhat 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.
- shawn 9y agoIt's fun to talk to kids! Many of them are way more curious than most people are.
- sizzzzlerz 9y agoAnd 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.
- insensible 9y agoDad 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.
- curun1r 9y agoI'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.
- kiliancs 9y ago> “A function is like a machine where you put something in one end and something comes out the other end. For example, maybe you put a number in, and the number that is one bigger comes out. So if you put in three, four comes out, or if you put in six, seven comes out.” Examples are such a useful tool to explain complex subjects and make them approachable.
- rocky1138 9y agoThis is my biggest complaint with manpages, historically. Many of them don't have examples and only describe the command switches in a list.
- gowld 9y agoEXAMPLES is one of the primary categories of man pages. Your broader problem is that "The full documentation for * is maintained as a Texinfo manual", and most people never learned how to access and navigate those. https://www.google.com/search?q=%22The+full+documentation+for+*+is+maintained+as+a+Texinfo+manual%22 https://www.google.com/search?q=%22The+full+documentation+fo...
- rpwverheij 9y agobeautiful read, thank you. Does anyone collect these educational inspirational stories?
- Vosporos 9y agoWell, you could be starting today ;)
- mncharity 9y ago> Does anyone collect these educational inspirational stories? That might be really useful. Maybe one barrier to improved education, is people having difficulty visualizing it? Last summer, I tried to explore teaching atoms in early primary, with a focus on nucleons and nuclei.[1] One big surprise to me in discussions, was a pattern of non-linear response to my saying "teach nucleons to kids". One physics postdoc, one with a professional focus on introductory physics education, replied basically "Absurd! How could you teach muons to kids!" It turned out that for them, "teach nucleons and nuclei" meant understanding muons. "Teach ... to kids", wasn't enough to change that image. So they tried to imagine teaching muons to kids, and exploded. Another physics postdoc tried to picture kids chalking quantum math on some graduate seminar blackboard. And was "WTF?" baffled. A primary-school teacher heard "teach atoms", and tried to picture early-primary students memorizing and regurgitating 4th-grade paragraphs of definitions. Because for them, that's what "teach atoms" meant. And more. These weren't outliers. I ended up using an analogy. That it was like proposing to teach kindergarteners about traffic lights. And having highway engineers declaring "Absurd! There's no way kids could understand those standards documents! And they're expensive! And the Chinese ones are in Chinese! You're think you can teach technical Chinese transportation standards documents in kindergarten!?!" "Red means stop; green means go." "Atoms are sticky little balls that jiggle." I'd expected that crafting accessible leverageable descriptions would be hard. And that how well one could achieve transferable understanding, at various ages, would be an open question. But I didn't expect that people would initially be so dramatically unable to picture the possibility of teaching some topics. People were fine after a "kindergarten traffic lights ... green means go... not network theory" story to set context. But I wonder... Might there be a badly underappreciated need for stories like OP? To provide "Oh wow... I wouldn't have imagined one could teach that... Now I can picture it..." That's an idea for helping to disrupt education that I've not seen before. [1] a crufty slow-loading page, intended merely to set up in-person discussions, but I've nothing better: http://www.clarifyscience.info/part/Atoms http://www.clarifyscience.info/part/Atoms
- tzahola 9y agoThis brings me back to ~20 years ago when my dad was explaining me Bresenham's circle drawing algorithm. I was 8 at the time I think.
- curuinor 9y agohttp://worrydream.com/AlligatorEggs/ http://worrydream.com/AlligatorEggs/
- jawns 9y agoWhen 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?!?
- k__ 9y agolol, is this some elaborate troll?
- platinumrad 9y ago>troll Yes >elaborate No
- kazinator 9y ago> 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"
- jawns 9y agoVery true, and I did actually explain that to him. In my rush to tell a good story I left out the pedantic part.
- petra 9y agoSide question: maintenece of functional programs is easier, because you don't need to think about state. Could it be used to create a functional programming language, easily understood by non-programmers or beginners , so they too could take a program and adapt it to their needs ? Does such language exist ?
- darkkindness 9y agoMaybe Pyret? https://www.pyret.org/ https://www.pyret.org/
- colatkinson 9y agoI 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.
- nickpsecurity 9y agoOne of the folks behind that is also involved in this: http://www.bootstrapworld.org http://www.bootstrapworld.org They're claiming to get good results teaching young people a number of important topics, including coding. They're also either using Pyret or planning to use it.
- albertgoeswoof 9y agoIt already exists, MS Excel
- TuringTest 9y agoAlmost anything in the End User Development research field.
- jdmichal 9y agoI 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.
- hvass 9y agoThis is the best thing I've read in really long time.
- gpmcadam 9y agoFunctional parenting. Cool!
- austincheney 9y agoThe link to the article is not working for me right now, so I cannot see how they define functional programming. In my years of programming I have seen the concept of functional programming defined in one of two ways: in context to call/response or in context to containment/scope. The call/response perspective emphasizes that functions are instantiated against a reference that can be called and that such a call returns a value. The containment/scope perspective emphasizes that functions are a bag of instructions containing a child scope and thus a lexical structure if nested. While both descriptions are valid they produce wildly different explanations and code examples that are often completely unrelated.
- deleted 9y ago[deleted]
- ujal 9y agoI've grokked programming only after being exposed to Lisp. Before Lisp, learning how to programme seemed like a never ending exercise. After, I realised I already know everything I need to know - data in, data out…
- cup-of-tea 9y agoYes. There is an old piece of sage advice: learning Lisp will make you a better programmer, whether you actually end up using it or not. Any paradigm you can think of is really just something you could do in Lisp...
- heinrichhartman 9y agoI had a somewhat similar encounter with a 4 year old (!), who blew me away with his ability to solve arithmetic puzzles: http://heinrichhartmann.com/blog/2016/06/12/Box-Counting-Arithmetic.html http://heinrichhartmann.com/blog/2016/06/12/Box-Counting-Ari... It's a great joy to work with such gifted young minds.
- wahern 9y agoSuch precociousness is often[1] an indicator of abnormalities and handicapped general intelligence. For example, if our son independently began to read too early the initial reaction of my spouse, a Speech-Language Pathologist, would be to freak out rather than to be filled with pride. Perhaps you know this and used "gifted" in its more euphemistic sense. In any event, I mention this not to correct you but to address the parental anxiety engendered by examples such as you gave. [1] Depending on the activity and age of onset, they can be so strongly correlated that attentive educational professionals would recommend diagnostic tests to identify any condition (often some category of autism) and permit early intervention to minimize the negative developmental aspects.
- gowld 9y agoThe 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.
- wahern 9y agoI 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.
- your-nanny 9y agoCool game; used to do something like that with kids, but more in context of sequence patterns. still, the game is limited to functions that are specified intensionally. Extensionally specified functions with no readily identifiable intension (like a function whose pairs are the result of a random pairing) are not really guessable. Oh well those are boring anyway...
- jrochkind1 9y agoomg is that kid gonna be a hacker.
- TuringTest 9y agoI wish someone would explain all of Category Theory like this to me.
- darkkindness 9y agoYou might enjoy https://graphicallinearalgebra.net/ https://graphicallinearalgebra.net/. The author uses Legos to describe algebras and diagrams to describe symmetric monoidal categories.
- offbytwo 9y agoThanks for this!
- zwass 9y agoBrent 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-intuition-and-the-monad-tutorial-fallacy/ 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 http://www.cis.upenn.edu/~cis194/spring13/lectures.html)
- teirce 9y agoI'll second this; he is a fantastic teacher. I had the incredibly fortunate opportunity of learning from Brent in my undergrad at Hendrix, where he currently teaches. There are other comments here that praise his patience with regard to teaching these topics to a child. I can say without a doubt he maintains the same patience with all of his students - not just his children. If you ever have the opportunity to learn from Brent (be from a course, blog, or talk), I would highly encourage it. I'm glad to see a post of his making its rounds on HN.
- galdosdi 9y agoYou did CS at Hendrix College? I did too ('11) and can't help mentioning it even though I have little to say... because hey, small school, tiny department, it's not often you run into another Hendrix CS alum, even virtually. And after years in "industry" I really appreciate the surprisingly good CS education there for a not well known school How's the dept doing these days? Is Ferrer still there?
- gjf2a 9y agoHi 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.
- motohagiography 9y agoThis 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.
- falcor84 9y agoI 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.
- kowdermeister 9y agoYeah, it adds time to the equation :)
- abdullahkhalids 9y agoI disagree with your example being a bad and reason is right there in your comment: the word "protocol". From wikipedia we find that a "communication protocol is a system of rules that allow _two or more entities_ of a communications system to transmit information...", where I have underscored the essential phrase and cryptographic protocols are just a subset of communication protocols. The reason that Alice and Bob are introduced is because they are different entities and each has different powers, restrictions and goals. If you want to do a correctness or security analysis of a protocol, introducing and defining these parties is hugely important and useful. Otherwise, its very easy to make mistakes about where information is in the system and how it is being manipulated. More generally, there is a philosophical approach called operationalism [1] that demands that all science theories be couched in terms of protocols so we don't make mistakes about what they say. [1] https://plato.stanford.edu/entries/operationalism/ https://plato.stanford.edu/entries/operationalism/
- make3 9y agoJesus 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
- j2kun 9y agoFunctional programming? What he's describing is machine learning! :)
- mar77i 9y agoActually, 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.
- ferrolho 9y agoAnd that is how a programmer is born.
- kyleperik 9y agoI 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.
- mcv 9y agoI'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.
- dev_north_east 9y agoBut you've explained the concept of a blockchain to them though, right?!!
- weatherlight 9y agoMines 1 1/2...Better have "The Talk about FP" soon.
- acobster 9y agoThis 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.
- mmirate 9y agoFunctions? Algebra? How is comprehending any of that, possible without the sort of abstract/counterfactual thinking that develops around age 12?
- berg01 9y agoIt's not, but do you really think that's going to stop true FP believers from upvoting this article?
- cdelsolar 9y agoI was programming functions in my brother's calculator when I was 8..
- nnq 9y ago...who told you that lie? An educational psychologist? More like "at age 12 even the most incompetent teacher can teach things involving abstract/counterfactual thinking to even the least intelligent child"... the bad ol' "lowest common denominator thinking" and the other horrors of our standardized educational systems :| Unfortunately it's not economically feasible to lecture to children in a classroom unless you calibrate on the lowest common denominator. Also, it's the huuuge difference between "understanding" and "being able to communicate efficiently in words". People can "grok" very advanced stuff even if they don't fully command the language for expressing it. Unfortunately most incompetent teachers are totally incapable of "trying to explain something beyond the level of the language" but the human brain's pattern matching engines are not always tied to language...
- mmirate 9y ago> ...who told you that lie? An educational psychologist? https://en.wikipedia.org/wiki/Piaget%27s_theory_of_cognitive_development#Formal_operational_stage https://en.wikipedia.org/wiki/Piaget%27s_theory_of_cognitive... Fine, I was off by one year.
- fiatjaf 9y agoStill a lie. And you still believe in it even after seeing an example in contrary.
- abecedarius 9y agoThis game can be played in a group, too: https://en.wikipedia.org/wiki/Zendo_(game) https://en.wikipedia.org/wiki/Zendo_(game) > once the guesser thinks they know what the function does, the players switch roles and the person who came up with function specifies some inputs in order to test whether the guesser is able to produce the correct outputs. In Zendo when the guesser offers the wrong rule, the 'master' must tell them an (input,output) pair where the guess disagrees with the rule the master had in mind. Then play continues.
- evincarofautumn 9y agoCome to think of it, I find Zendo much harder than the game described in the article. I think it’s because the inputs (arrangements of shapes) are more complex than numbers, and the outputs (Booleans) give you less information than numbers.
- abecedarius 9y agoI'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?
- laurentlb 9y agoIf 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/ http://laurent.le-brun.eu/games/rules/
- dottKon 9y agoWhat a great and heartwarming story! It really puts a great example to the old rule of thumb that 'you can be sure you understand the concept once you successfully explain it to a five-year old'.
- dclowd9901 9y agoI always liked to imagine a scenario where my daughter would invite me to her class to talk about what I did, and I would try to explain the concept of programming to young children. I would pretend to be a robot, and they would have to command me to do things, but I would only do them exactly as they described them. I had a similar experience when I was in school and it really stuck with me. Kids love this shit, they just need it in a way that lights up their minds a bit.
- endlessvoid94 9y agoObligatory "Mindstorms" recommendation: https://www.amazon.com/Mindstorms-Children-Computers-Powerful-Ideas/dp/0465046746/ref=sr_1_4?ie=UTF8&qid=1525736070&sr=8-4&keywords=mindstorms https://www.amazon.com/Mindstorms-Children-Computers-Powerfu...
- logicallee 9y agoIf this anecdote is credible (and I don't see any reason it wouldn't be) then in four years this kid will ask, "What are you reading?" and then the father will say what he's reading - and then sheepishly as for help from the ten year-old on the part he's stuck on. I mean this kid is clearly superlatively gifted.
- gowld 9y agoThe parent is also superlatively gifted. http://ozark.hendrix.edu/~yorgey/ http://ozark.hendrix.edu/~yorgey/
- thomasfedb 9y agoAnd 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.
- osteele 9y agoFun(ctional)! When my daughter was in 4th grade, I volunteer-taught a group of pull-out 4th–6th graders, so that she could have some peers to do math with. You might enjoy this set of math worksheets I created for them. https://www.scribd.com/document/15720543/Squarrows https://www.scribd.com/document/15720543/Squarrows [EDIT: now also at https://drive.google.com/open?id=1hfzm3Rvm4xpwp_xHUKBHxuIEgfecZkiI 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.
- gowld 9y agoIs there a non-scribd (Google Drive) way to download the PDF?
- osteele 9y agoI put it at https://drive.google.com/open?id=1hfzm3Rvm4xpwp_xHUKBHxuIEgfecZkiI https://drive.google.com/open?id=1hfzm3Rvm4xpwp_xHUKBHxuIEgf.... Please let me know if that fails, and I’ll try to fix it.
- gowld 9y agoThank you!
- fiatjaf 9y agoScribd is the worst thing on the internet. Please stop using it.
- pbnjay 9y agoThanks! I think my 6yo would like doing these (though he doesn't have a strong grasp of multiplication/division yet).
- kowdermeister 9y agoI enjoyed reading this story :) Nice buildup to the gate of complex problems. I remember that at elementary school we turned on a bunch of C16-s at the same time and we tested random number generators and some showed the same value, cool demo of determinism instead of xλ6 I would have chosen xλ3.14159265359 it might lead to different questions, but who knows, just deeper rabbit holes :)
- 77pt77 9y agoThe difficulty in conceiving of a constant functions seems similar to the difficulty in recognizing that > if 4 is prime then all numbers are prime Is a true theorem (and things along these lines)
- pbhjpbhj 8y ago>> if 4 is prime then all numbers are prime >Is a true theorem (and things along these lines) Saying "4 is prime" "primes are non-composite, ..." reduces to error; at least one of these premises is false. ?
- mbil 9y ago> It’s called the function machine game. I will think of a function machine. You tell me things to put into the function machine, and I will tell you what comes out. Then you have to guess what the function machine does. Cool, this sounds like a general form of the picnic game[0]. An input to the "picnic" function is a food (or other object), and the output is whether or not it can be brought to the picnic. The picnic game's hidden function that needs to be uncovered is a predicate function. E.g. if the hidden function is "Things that start with the letter A", then "apples", "anchovies", and "albatrosses" could be brought to the picnic, but not "bananas", "cameras", nor "dessert". In that example, the function would look like: lambda x: x.firstLetter() == 'a' [0] https://www.thegamegal.com/2011/06/11/going-on-a-picnic/ https://www.thegamegal.com/2011/06/11/going-on-a-picnic/
- uryga 9y agomy favorite snack is "" ! (pronounced " ")
- fao_ 9y ago> (and to be fair, free theorems are only interesting when polymorphism is involved which I definitely didn’t want to go into). "there's a thing called polymorphism, and it means 'of many forms', what it means is that if you put the thing in, you're guaranteed to get a specific type of thing out, but it might be different depending on what you put in. So you put words into the machine, and letters come out, but if you put lists of numbers in, numbers come out."
- jason_slack 9y agoI'm taking a discrete math class right now. How is this read: \lambda x.\, x - 3 and what is a simple example? In a discrete math perhaps it is the same as "All x, x is an integer such that...."?
- craftyguy 9y agoThe '\lambda x' is just another way of saying "f(x)" So '\lambda x., x-3' --> 'f(x): x-3' Also, I really enjoyed my discrete math courses! The proofs were.. tedious.. but the amount and breadth of 'stuff' covered was excellent.
- jason_slack 9y agoIt is a difficult course! We are doing graph theory right now.
- bovik 9y agoIt's just jargon. I really don't know why the title isn't just "Conversations with a six-year-old on functions" and "f(x) = x - 3." You lose nothing, increase your audience 100fold, and it's more intellectually honest. It is a less hackernews clickbaity title, though.
- omegaham 9y ago> "How is this read: \lambda x.\, x - 3" I'd read it as "Lambda x maps to x - 3." In Python, you can rewrite lambdas as regular functions if you want. lambda x : x - 3 is the same as def f(x): return x - 3 This runs in the IDLE as such: >>> f = lambda x : x - 3 >>> def g(x): ... return x - 3 ... >>> f(0) -3 >>> g(0) -3 >>> (lambda x : x - 3)(0) -3
- ryanpcmcquen 9y ago"If you can't explain it simply, you don't understand it well enough." - Albert Einstein Brent definitely understands it well enough.
- lobster_johnson 9y agoEinstein never said that, though: https://skeptics.stackexchange.com/questions/8742/did-einstein-say-if-you-cant-explain-it-simply-you-dont-understand-it-well-en https://skeptics.stackexchange.com/questions/8742/did-einste....
- ryanpcmcquen 8y agoGood find! Looks like he said something similar, but never those exact words.
- Delfino 9y agoThis 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.
- sAbakumoff 9y agoPoor kid...I imagine how his classmates would react if he offers them to play machine function game
- OJFord 9y agoI remember exercise sheets at school (in the UK) like this - I think called 'number machines'. I _hated_ it; felt patronised by the illustrations of these machines, so I rebelled by trying to come up with a different correct solution - aware that there were infinitely many answers given just a few example domain/range pairs. But if anyone's interested in them for a car journey or some time you can't play this game aloud, there ought to be examples available online aimed at teachers.
- gowld 9y agoWhat's to hate? You solved the problems correctly and creatively. Any given reasonable limits on complexity of solutions (simpler -> better, Occam's razor), there are only a few solutions to any given problem.
- OJFord 8y agoI was just being facetious. It was too easy to identify that numbers are being doubled, so I'd contrive something else instead, that happens to be equivalent for the few examples given.
- Amaze 9y agoHii
- bovik 9y agoThis is really just a conversation about functions...
- phonebucket 9y agogreat stuff. what is consciously learnt and discovered by one generation can be intuitive to the next, precisely because of teaching. also, i love the idea of experimenting on your own children and then writing blog posts about it :)
- allenleein 9y agoFor beginner who wanna learn Haskell and Purescript, I recommend those resources: https://github.com/allenleein/brains/projects/9 https://github.com/allenleein/brains/projects/9
- Steuard 9y agoThis sounds a lot like the card game "New Eleusis": http://www.logicmazes.com/games/eleusis/index.html http://www.logicmazes.com/games/eleusis/index.html http://matuszek.org/eleusis2.html http://matuszek.org/eleusis2.html http://matuszek.org/eleusis0.html http://matuszek.org/eleusis0.html It's meant to "simulate scientific research", sorta: one player ("God" or "Nature") comes up with a secret rule for what cards are legal to play in a given situation, and then the other players take turns playing cards to figure it out. It's a lot harder than you think, even with quite simple rules. (The scoring system is meant to reward a "God" player for coming up with a rule that's not obvious but still guessable.)
- skate22 9y agoI hope my kids want to learn and are curious about how things work like the OP's kid! I dont want to be one of those parents that pushes their kid to the point that they dont enjoy learning or suffer socially. Asking for a future me: how do you give your kid the best chance / environment to develop socially, but still enjoy learning & embracing the nerdier things?
- icc97 9y agoI sent mine to a Steiner / Waldorf school on the hope that this is more of a social / confidence building environment. Then I surrepticiously feed her inner geek at every opportunity I can find. My personal current favourite is Wild Kratts [0] which teaches a amazing number of things. Also we send my daughter to a violin school where they teach the suzuki method which has a fairly nerdy type of group of parents that go there. So it means she's in a school that accepts most types of people whilst exposing her to nerdy things outside of school. Curiously I found that a lot of the parents who send their kids to a Steiner / Waldorf school tend to be nerdier. The best example was a couple where the mother was had a Philosophy degree with a Physics PhD and the father travelled around the world as a street puppeteer. [0]: https://en.wikipedia.org/wiki/Wild_Kratts https://en.wikipedia.org/wiki/Wild_Kratts
- bitcoinmoney 9y agothis is super expensive. How much do you need to earn to send your kids to schools like this.
- icc97 9y agoIn Belgium the Steiner school is free
- savanaly 9y agoMy 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.
- icc97 9y ago> Or maybe there is a function machine where you put other function machines in and get function machines out! Made me think of higher order functions as self-replicating machines [0]. [0]: https://en.wikipedia.org/wiki/Self-replicating_machine https://en.wikipedia.org/wiki/Self-replicating_machine
- ooronning 9y agoAd redirect on mobile, beware subway commuters
- dzink 9y agoTeaching 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?
- weatherlight 9y agoMines 1 1/2...Better have "The Talk about FP" soon. ;)
- TheKarateKid 9y agoI loved reading this. When I was that age, I used to ask so many questions to my father and I was lucky that he was always happy to not just answer, but explain everything. If he didn't do that, I may not have followed the path to where I am today.
- d--b 8y agoI 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.
- sulZ 8y agoWhen I was working as a math tutor I would sometimes have to explain composition to a student for an introductory algebra class. When it finally clicked to them that you could pass functions into other functions many other concepts seemed to come to them more easily. Those were some of my favorite moments at that job.
- astoilkov 8y agoIf you like this article I would definitely recommend this one too: https://hackernoon.com/how-my-10-year-old-learned-javascript https://hackernoon.com/how-my-10-year-old-learned-javascript