Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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

Another game I play with my kids to introduce the concept of functions which aren't just for numbers is a haircut function. You start by deciding on what the function does (curls hair, cuts it short, makes it longer), write that in the middle of the page, then you draw some input people on the left of the page, and on the right hand side draw the output for each input. Bonus points for running the function twice to see what happens to that person. This is a popular game with my kids and gets them involved as they can draw their own.



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

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


This reminds me of a prediction game experiment I heard that was described like the following. \*

The researchers presented the following to people.

   f(1) = true
   f(2) = true
   f(4) = true
   f(8) = true
And asked, what is f?

And the people will immediately jump in and test 16, 32, and then proudly declare that

   f = x -> x = 2^n for some integer n
Forgetting to test f(3), f(5), etc.

With more examination it turns out that

   f = x -> true.
\* I wish I could remember more of the details such as whether it was an experiment or just an illustration of one but it's not an easy thing to search for and I rely on memory and searching too much.


Something like this is in Josh Tannenbaum’s PhD thesis, where he calls it “The Numbers Game.” https://dspace.mit.edu/handle/1721.1/16714

He uses the game to show that people do something akin to Bayesian updating over possible concepts and have certain intuitive priors (e.g., ‘even numbers’ is a priori more likely than {2, 7, 9, 31}).

This is briefly mentioned at the beginning of Kevin Murphy’s Machine Learning: A Probabilistic Approach, so you might also have encountered it there.


Sounds a lot like Derek Muller’s (Veritasium) video:

https://youtube.com/watch?v=vKA4w2O61Xo


Thanks, that's it!

A good video and better than I explained it too.

The video says it's inspired by Taleb's Black Swan so I suspect I read it in that too.


a similar thing happens with folks when debugging. They assume something, and test their assumption and can happily declare victory. Instead, they should be testing _against_ their assumptions to prove their theory wrong.


> Instead, they should be testing _against_ their assumptions to prove their theory wrong.

I think this mindset should be taught explicitly starting in grade school.

If you have an idea, think how you'd disprove it, and test it. If you can't think of how you'd disprove it, that's a strike against the idea. If you can't test it, that should at least make you suspicious.


In theory, that's the scientific method, but aomehwt we've evolving this weird grade school science project "scientificky" method in it's place.


I taught at a programming camp one summer, and my favourite example of this that I drove several kids crazy with was "above the line, below the line".

Given any input word, I would tell them whether it was above the line, or below the line (which corresponded to acceptable and unacceptable behaviour in camp-speak). I think only two kids figured it out on their own, and each time I challenged them to write a program to categorize words automatically.

I wonder if hacker news can figure it out :)

"Hacker" -> Above the line

"News" -> Above the line

"chrisweekly" -> Below the line

"functional" -> Above the line

"programming" -> Below the line


(Spoiler?)

I think it's called "above the line" "below the line" because the characters in each of the accepted words don't travel below the "character placement line" that runs along the bottom of every word. I've forgotten the "real name" for this line.

Thus,

  toothpaste -> below the line, because of "p"

  tooth -> above the line, no characters pass below it.
Generally, if the word contains a y,p,q,g, or j, then it's "below".

Right?

EDITS:

1: TIL the name for this property of a character is called a descender[1]. (And yet I still can't find the name for that blasted line.)

2: It's called a baseline[2], thanks taylorlunt

REFS:

[1] https://www.merriam-webster.com/dictionary/descender

[2] https://typedecon.com/blogs/type-glossary/baseline/


This is the right answer! I think it was made harder in the camp due to "above the line" and "below the line" already having semantic meaning in the context of the camp, most kids didn't expect that to literally be the answer.


yeah that makes sense, thanks for sharing it with us!

I'll likely use it to mystify kids someday soon.


That reminds me of “green glass door” and what you can and can’t take with you to magic land through the door.


The line is called a baseline.


Thanks :)


    let descenders = ['q','y','g','p','j'];
    let isBelow = (word) => descenders.some(d => word.includes(d));

    let tests = {
      "Hacker" : false,
      "News" : false,
      "chrisweekly" : true,
      "programming" : true,
    };
    
    for (const test in tests) {
      let pass = isBelow(test) == tests[test];
      console.log( pass ? `Passed for ${test}` : `Failed for ${test}` );
    }


Ding ding ding. You get extra camp tickets for adding tests :)


Rather depends what font the quizmaster is speaking in: https://graphicdesign.stackexchange.com/questions/71807/what...


Ha, yes, and what language. My example won’t work for ŷ and any others like it.


Just a guess:

    data TheLine = Above | Below

    categoriseWord :: String -> TheLine
    categoriseWord s
      | length s <= 10 = Above
      | otherwise      = Below
There's not a lot to go on, though.


There is a similar game that goes like "The king does not like tea but he does like coffee". The you can ask questions like "Does he like cookies?" (answer: yes), "Does he like cats?" (answer: no)


Curious that the way we play these games is “race to the answer” in fewest tests, and as soon as someone else gets it, the game is over and spoiled for anyone who didn’t.

Is there a good way to play to train for “most confidence before answering” without making it a drudge of endless tests and humhawing?

Making each question a more powerful test would be good, but that’s not what racing to the answer encourages, that encourages guessing the teacher’s password.

What about tests are free, first to answer wins, but a wrong answer or two disqualifies you completely?


Words go below the line iff they contain the same letter twice in a row


Been -> Above the line

Fuzzy -> Below the line

Weeds -> Above the line


In college a friend had about 10 of us dumbfounded for an hour as we tried to figure out what "The land of Nodd" was.

The land of Nodd has floors, but no ceiling. It has grass but no lawn. It has no animals but there are teeth. Etc.

The game is we asked him questions about whether it has something or does not, and we had to figure out what "The land of Nodd" was :P


I'm guessing Nodd has a lot of bookkeepers!


I'm taking this comment as evidence that I've succeeded in figuring it out.


We used to play a game in summer camp where one had two sticks and could hand them to the next person 'crossed' or 'uncrossed' declaring as such. The key was it was the persons legs, not the sticks, which determined if one was passing the sticks 'crossed' or 'uncrossed'.


Current list of words is consistent with "has an even number of letters".

What about "Hacks"? It uses only letters found in accepted words, but should be rejected because of the odd number of letters.


Check for odd or even string length?

  "Above the line" if len(s) % 2 == 0 else "Below the line"


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


Did anyone ever just try and search through a phylogenetic tree?


Basically yes, that is what the games evolved in to.


I remember a friend pranking other friends, the quizmaster would rotate his pair of hands palm up or palm down and the victim had to guess either "opened" or "closed". Slowly the kids would get it after a few steps, frustrating the "main" victim of the prank. In the end it turned out the state was whether the quizmaster left his arms pressed against his body (closed) or a few inches "opened". A variant would be whether he'd leave his lips pressed together or slightly apart...


For a non-road-trip version of this idea, check out Zendo: http://www.koryheath.com/zendo/

You don’t have to use the official Looney pyramids, of course, but those work really well. Just enough variations to be really interesting.

There’s an older game that uses playing cards, Eleusis: https://en.wikipedia.org/wiki/Eleusis_(card_game)


I sure hope the haircut function mutates it's input, and doesn't return a clone whose hair is cut.


Reminds me of a YouTube video which said every time someone gets beamed in Star Trek they are killed and someone else is created with their body and mind somehow. If that were possible, why wouldn’t they just store backups and “restore” from backup when someone died?


> a YouTube video

CGP Grey: The Trouble with Transporters https://www.youtube.com/watch?v=nQHBAdShgYI

Steve Shives: Is Star Trek's Transporter Actually a Murder Machine? https://www.youtube.com/watch?v=f-8zEkIaB0c

> why wouldn’t they just

https://allthetropes.fandom.com/wiki/Story-Breaker_Power

For purpose of storytelling, these powerful side effects of transporters need to be restricted. Hence, as an in-universe explanation, a pattern buffer

∙ is a physical phenomenon that cannot be (fully) expressed as information

∙ deteriorates over time, so needs to be rematerialised soon.

For the exception, see https://memory-alpha.fandom.com/wiki/Relics_(episode)


This is something that is addressed in the show! Pulling all my knowledge from just TOS and TNG;

There are 3 broad cases:

1. Something goes wrong during transport and the person cannot be rematerialised. Typically they end up "stuck" in the pattern buffer of the transporter. Some fiddling and plot tension allows them to complete transport by the end of the episode

2. A partial transport leaves some part of the person behind. This is where you can end up with weird things like piles of sludge on each end, or evil doppelgängers who are mostly the same, but only some features were transported

3. Unknown phenomenon that creates a duplicate. The original has general "failed to transport" experience, while the clone has a complete experience and is so none the wiser that "they" also got left behind.

From this we know that the pattern buffers can absolutely be used to store "backups". This is even discussed at some points after a crew member unexpectedly dies. However what complicates matters is that typically the patterns rapidly lose coherence in the buffers. Whether this happens immediately or after many years is left up to the plot requirements. Generally it seems that unused transporters will hold the last pattern they transported as long as their power supply is stable and are not travelling through space. Anything involving warp, fluctuating power, or transporting other people immediately clears the buffers (and can even cause transporter failures)


There's a notable book by philosopher Derek Parfit called "Reasons and Persons" that—among other things—uses "transporter" thought experiments to explore the nature of personal identity.

The quasi-buddhistic conclusion, with which I agree, is that personal identity is largely an illusion. It's an easy illusion to maintain however, given that in practice our "software" is very difficult to "copy" exactly.

https://en.wikipedia.org/wiki/Reasons_and_Persons#Personal_i...


A type of restoring from backup, well the short-term pattern buffer memory, has been a feature of several "transporter" episodes I think?

Like "no, we lost them; maybe they're 'in' the pattern buffers".


;)


The way maths is taught in Australia, for a long time the term function was synonymous with the concept "2D plot that passes the vertical line test" in my mind. I was completely unaware of how much broader and more interesting a concept functions are. There are probably many people whose understanding never progresses beyond this, which I think this is extremely unfortunate.


For what it's worth, this intuition is sound and I think it works just as well if you formalize[1] it to be used to illustrate the lambda calculus.

[1] http://dkeenan.com/Lambda/




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

Search: