Reading
Topic: Data definition of pic
Remarks: Helpful, and some important general concepts
Relates to: recursion, and composite data
on-test? not until we have data definitions officially

 


A data definition for pic:

a gentle intro to recursive data definitions...

When we start working with composite data, we will use data definitions. Because pic is a fairly fancy kind of data, this is not a very precise data definition, but it will get us started. There is a somewhat more formal definition of a pic in the big comment in the Teachpack's source code, piccy-graph.ss, if you are interested.

A pic is defined as either:

where

Note that there is a PIC in the definition of pic!

That seems weird, doesn't it. See the examples below, and then look at the purple definition again.

This is called a recursive definition. Recursion lets little definitions define big things. The important thing is that a recursive definition is precise enough to make computers (and certain kinds of people) happy. See how it works? Recursion is a pretty wonderful topic and we'll be learning lots more about it, believe you me.