Geometry
Introduction
We start with the simplest vocabulary of images, with “left” and “right” and “one, two, three,” and before we know how it happened the words and numbers have conspired to make a match with nature: we catch in them the pattern of mind and matter as one.
Imagine that you have control of a little creature called a turtle that exists in a mathematical plane or, better yet, on a computer display screen.
The turtle can respond to a few simple commands:
forwwardmoves the turtle, in the direction it is facing, some number of units.rightrotates it in place, clockwise, some number of degrees.backandleftcause the opposite movements.
The number that goes with a command to specify how much to move is called the command’s input.
In describing the effects of these operations, we say that:
forwardandbackchange the turtle’s position (the point on the plane where the turtle is located)rightandleftchange the turtle’s heading (the direction in which the turtle is facing).
The turtle can leave a trace of the places it has been: The position-changing commands can cause lines to appear on the screen. This is controlled by the commands penup and pendown. When the pen is down,
the turtle draws lines.

In describing the effects of these operations, we say that forward and back change the turtle’s position (the point on the plane where the turtle is located); right and left change the turtle’s heading (the direction in which the turtle is facing).
The turtle can leave a trace of the places it has been: The position-changing commands can cause lines to appear on the screen. This is controlled by the commands penup and pendown. When the pen is down, the turtle draws lines.
Function
Turtle geometry would be rather dull if it did not allow us to teach the turtle new functions.
But luckily all we have to do to teach the turtle a new trick is to give it a list of functions it already knows.
For example, here’s how to draw a square with sides 100 units long:
This is an example of function.
The first line of the funcion definition specifies the function’s name. We’ve chosen to
name this procedure square, but we could have named it anything at all.
The rest of the function (the body) specifies a list of instructions the turtle is to carry out in response to the square command.
There are a few useful tricks for writing functions. One of them is called iteration, meaning repetition doing something over and over.
Here’s a more concise way of telling the turtle to draw a square, using iteration:
Estás leyendo una vista previa.
Inicia sesión para leer el artículo completo. Cualquier cuenta abre 4 artículos gratuitos al mes; el alumnado y el profesorado leen las páginas de su curso sin límite.
Iniciar sesión