Scheme Programming for Six-Year-Olds


My six-year-old daughter is the student. All this happened on a single evening after dinner. I have previously exposed her to Logo. She found it difficult, since it required understanding of angles. Furthermore, it is fairly non-intuitive to stare at a little triangle trying to work out where is front and what is left or right. Turtle graphics requires a sense of orientation, and I don’t think she managed it at all. Better would be a simpler class of Turtle graphics where turtle could be told to move Left, Right, Up, Down in a grid (i.e. 1 unit = 20 pixels). It would have been easier to advance to other concepts quicker.

Getting Scheme

I used Guile, running under Cygwin.

First Exercise (addition)

>(+ 1 1)
>(+ 1 1 1)


  • She has trouble with the round brackets, which required using the shift key. Are there alternate syntaxes which uses square brackets instead?
  • Guile isn’t the best, as it tries to parse arrow-key key-presses as input, and ends up printing a lot of rubbish on the screen. It didn’t deter the girl, but I found it hard to get the REPL prompt back short of CTRL-D and restarting.
  • I had a look at the JScheme applet. The Eval button clears the window contents. This is bad for a six-year-old, who needs to program by example through looking at the history pane.
  • PLT DrScheme has a similar problem with the arrow-keys.
  • I left her to play with it until she got bored.

Second Exercise (precedence)

Thankfully, my six-year-old has no concept of operator precedence. So Scheme is a good fit, since it requires everything to be explicit.

>(+ 1 (+ 2 3) )

I explained that we can ask the computer many questions at the same time. The computer will try to answer one question, and remember the answer in it’s head. Next it’ll try to answer the other question using the answers it remembered. She didn’t seem to get the concept, so I’m going to have to work it out on paper for her.

Actually, the kids have a set of toys much like Russian dolls. Perhaps I can use that as an aid.

Question: Is there any scheme mode that will print the reductions before it arrives at the final answer? i.e.

>(+ 1 (+ 2 3) )
>(+ 1  ( 5 ) )

Update: DrScheme does this. Just type the source into the define window, and then hit Step. However, it’s probably still a bit confusing for a little girl.

Third exercise (functions)

I introduced alternatives to “+”, introducing a function “age” which computes her age, given her brother’s age. She seemed to have lots of fun with it.

(age 50)

“I’m going to be 52 when brother turns 50!”, she exclaims.

Comments so far

The round braces are a definite problem. It is too easy to have to few or too many. Perhaps a structured text editor which provides the round braces by default might solve that problem. She also had a few problems with spaces, like typing (+5 5) instead of (+ 5 5).
A beginner’s scheme should be more forgiving here.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>