Logo data types

Words and lists

It will come as no surprise that computer running Logo is not restricted - like a calculator - to crunching numbers. Logo was designed from the outset as a general purpose symbol processing language. The data which it manipulates is represented by atomic symbols known as words or by structured elements known as lists. fido, for example, is a word and [lion tiger hyena] is a list.

In form, a word is simply any uninterrupted sequence of alphanumeric characters (which include - amongst a few other oddities - periods and commas). In this light, slow.down is a word (one word) and 10 is a word just as much as fido is. (How 10 is actually understood in LOGO depends in part on the fact that we write it with digits, but it also depends on how we choose to operate on it. If you try to add together 10 and 5, LOGO well certainly tell you that the result is 15 - because 10 and 5 are instances of a special sub-class of words called numbers - but at the same time you can request the first 'letter' of the word 10, and you will find yourself given quite naturally the character 1.)

A list, like a word, is also a sequence, but the constituents of a list may be either, in the simplest case, words - e.g. [lion tiger hyena] - or, in more complex cases, other lists - e.g. [ [jan stewart] [dan'l widdon] [old uncle tom cobbley] ]. Sometimes, if need be, they may be a mix of the two - e.g. [[dan'l widdon][eyes [bright blue][hair [dark brown]]. In LOGO, a list is identified by opening and closing square brackets.

In the limit a word may contain no characters and a list may contain no elements. The empty list - and there is of course only one empty list - is represented by opening and closing square brackets with nothing (or only the separator character, a space) between. The empty word is represented as a double quote mark followed by nothing. (A space after " separates it from the next word.)

Collectively, words and list structures are known as Logo objects

The meaning of Logo objects

This is all very well - you may impatiently say - but the crucial question is: What can a LOGO object mean? The simple answer to this is that it can mean whatever you like. It was for just this reason that we called Logo a symbol - rather than a number - processing language. Logo objects may, if you wish, represent concrete physical objects, but just as readily, they may embody abstract concepts or ideas. On occasions, you may, of course, use a word to represent a number but, as a LOGO programmer, just as often - and in our case much more often - you will use it with strictly non-numerical intent. (You will soon see that Logo itself uses words as the names of procedures.)

At first glance, it is not unreasonable to feel that although a Logo word may mean what you like, the the stark simplicity of the available data types - just words and lists - is bound impose serious limitations on Logo's ability to handle complex pheneomena. In practice, however, you will find it difficult to discover restrictions on the ideas which can be expressed. On reflection, this is not really too surprising. The basic LOGO objects, word and list, are directly analogous to the words and sentences of natural language. And presumably you are prepared to accept the proposition that in any natural human language we can talk about whatever we like.

Some sample words and lists

Just to challenge any lingering doubts that words and lists in LOGO provide the same opportunities, here are a few lists taken from a variety of domains to illustrate in a small way of the range of notions which can be handled:

LOGO lists and record structures

If you are familiar with computerised database systems, you will notice the similarity of many of these list structures with the records of a database, but notice that with LOGO lists you are not restricted to the single level of organisation which many simple database applications impose (where a record is composed of fields which have no further internal structure).

Lists in LOGO - take the overcoat as an example - can contain lists which themselves contain lists which themselves . . . And the nesting can in principle be continued ad infinitum, even if in practice the memory of your system will at some point force a halt.

LOGO lists and natural language structures

To see how Logo data structures can be used to represent linguistic constructs, click here.

Ron Brasington
Department of Linguistic Science
The University of Reading

E-mail: ron.brasington@rdg.ac.uk