Why This Matters
A primer on how Logo programs are built from small user-defined procedures that become indistinguishable from built-in primitives. It's a reminder of an educational language design philosophy—extending a vocabulary incrementally—that shaped how generations learned to think about abstraction and composability in code.
Key Takeaways
- Logo procedures are defined between 'to' and 'end' and can be composed into larger programs, as with square → flower → garden.
- Once defined, user procedures behave exactly like primitives, so code looks the same whether a word like 'pick' is built in or hand-written.
- The language's model—teaching the computer new words in terms of known ones—mirrors how people acquire spoken language, making it a natural teaching tool.
Logo programs are usually collections of small procedures. Generally, procedures are defined by writing them in a text editor. The special word to is followed by the name of the procedure. Subsequent lines form the procedure definition. The word end signals that you're finished.
In our turtle graphics example we defined a procedure to draw a square
to square
repeat 4 [forward 50 right 90]
end
and used it as a subprocedure of another procedure
to flower
repeat 36 [right 10 square]
end
Similarly, flower could be a building block of something larger
... continue reading