LC for kids (alligators, oh my!)

(via Wadler)

A visual LC game.

You can show it to the kids, or try to guess what each element in the game represents before reading the explanation at the end...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Good stuff

Thinking of writing a javascript/browser version of the game, but figure someone more enterprising will beat me to it. :-)

I am waiting for someone to

I am waiting for someone to come up with a typed version... or two...

Animal Kingdom

You'd have to introduce a whole slate of animals beyond the alligator family (badgers, mushrooms, snakes, lemmings). :-)

If you add a llama, would it

If you add a llama, would it make the language duck-typed?

If it looks a bit like a duck...

Perhaps a platypus.

[we can still have the eggs then]

That would convert it into a

That would convert it into a representation of the lesser-known Llama Calculus.


That was my initial reaction as well.
However, alligators represent lambda abstractions, not values of base types. As a bare minimum, we want to combine different kinds of heads and tails to represent the types of both the abstracted variable and the value of the function. E.g., Lemming->Badger could have a head of a lemming and a tail of a badger.

Now think about higher-order functions - what kind of monstrosities do we need to represent them? E.g., (Lemming->Badger)->(Lion->Mouse)?

These difficulties may explain why some people avoid understanding HOFs :)

Type lambdas

Lions and tigers and bears!

Lions and tigers and bears! Oh, my!

Not a game

Technically, would not this be not a game, but a toy (or a puzzle), as at every turn you can make only one legitimate move (dictated by the evaluation strategy)?

Decisions all upfront

Once set in motion, then there's no decisions that can be altered. But you have to do all the decision making and strategies upfront to get the desired effects. Mostly, a matter of amusement.


I actually wrote "toy" first, but changed it to "game". A toy being an object that can be played with in a variety of ways, where as a game has fixed rules... ;-)

Interactive fun without non-trivial opponent

I was subconciously using Chris Crawford's dichotomies (public version available from Wikipedia, look for "Crawford").

Of course, neither he nor Wikipedia are definitive sources, so I should have qualified my statement.

Interesting. I wasn't aware

Interesting. I wasn't aware of these, thanks!

There aren't any definitive

There aren't any definitive answers in the end - game is a cluster concept.

I would love that!

I would love that!

Test with a kid

OK tried the game with my 7 year old.

I used lite-brite because I didn't feel like all construction paper.

1) She was able to understand the game and the rules
2) She was mostly able to apply the rules with assistance. However she would forget things. I think a card with the rules listed would help. I'd assume that would go away with practice
3) She actually sort of liked it.
4) It took forever to even do simply combinations because of copying and moving. For example I did (plus 1 2) in about 10 minutes with her.

As an aside I found it much much harder than doing these things by hand using a piece of paper (traditional way). I tried showing her the traditional notation and she

1) Was able to see it was the same thing i.e.
"color rule" -> change of variables, eating -> application....
2) No longer liked it

(oh well).

(end test report)

No longer liked it:-) I

No longer liked it

:-) I think you can't fault a 7 year old for that. That is, unless she prefers Turing machines. If that's the case, she simply lacks taste ;-)


I took "no longer" to mean that the child exhibited that amazing human tendency to enjoy playing a game, but when it was revealed that the game related to something "difficult" and/or "not fun," the game itself stopped being fun as well. Related to Mark Twain's observation via Tom Sawyer that "'work' is whatever a body is obliged to do."

That, or alligators or

That, or alligators or whatever are a lot more entertaining than lambdas, as heretical as that may sound.


Pretty much that's what I would guess. She didn't tell me so I can only speculate.

But assuming your theory is true (that is what happened would be universal) then given my experience the situation is bleak. IMHO knowing about alligators meaningful requires knowing lambda because the number of extra steps in computations is overwhelming. However, once you try and show them lambda then they lose interest in alligators. So alligators don't solve the "how to teach little kids lambdas".

Alligators, educators

So alligators don't solve the "how to teach little kids lambdas".

If you were able to work through an addition (with Church numerals, presumably) with a 7 year old, and she paid attention for the necessary 10 minutes, I'd say that's pretty successful. The goal shouldn't necessarily be to try to teach little kids lambdas, it's to try to exercise their brains in ways that are equivalent to the ways that us boring adults sometimes need to use our brains. Then later on, lambda calculus will seem natural since the necessary skills already exist. Or so the theory goes.

It seems to me the real lesson here is, just don't tell a kid about the lambda calculus. (After all, you can scare off at least 85% of adult programmers by mentioning those two words.) Come up with some other cover story about the meaning of the alligator game, and see if you can figure out a way to get them to want to play it more than once.

A computer version of the game might be more viable for that, since it would take some of the manual labor out of it, and it might be possible to set up problems which have an interesting outcome (maybe introduce some datatypes...) I guess it'd converge on something like Toontalk in the end.

Slight clarification

If you were able to work through an addition (with Church numerals, presumably) with a 7 year old, and she paid attention for the necessary 10 minutes, I'd say that's pretty successful.

Just to clarify she worked through it. I just guided when needed. I actually do think with a little practice she could have worked through it without guidance.

Guidence was stuff like, "Don't forget before the alligator can eat you have to use the color rule" (this is alligator for, before function application / beta reduction you may have to perform alpha reduction to avoid ambiguity). But yes she understood how to do the reduction.
Or another example. She knew she had to replace all the oranges pegs with a copy of the alligator family directly to the right (i.e. beta reduction requires replacing all instances of the left most variable with the next expression....) She might not be able to successfully execute and would forget one of the orange pegs and leave it there.

In terms of understanding she could see the "two" looked kind of like the one with just another level. So she had some intuition. On the other hand "Plus" was just magic.

And as I've mentioned I actually think the alligator version is substantially harder than the lambda version! So I agree a computer aided version might help assuming you could figure out a way to do it with the kid still being able to see what was going on.