Ways of dealing with special characters in Logo PLUS

Special characters

In any keyboard interface to a computer system there will be certain characters (keystrokes or combinations of keystrokes) which have a special significance and which therefore cannot normally be accepted as text. In Logo PLUS, these special characters are: Lowercase letters are also special in the sense that they are not distinguished from uppercase letters. (Logo will accept lowercase input but converts it to uppercase - print "cat will display CAT).

Most systems fortunately provide ways to work around the limitations of special characters to cope with situations where it is absolutely necessary to use them. Though the work-arounds are more awkward than normal input techniques, the extra cost is assumed to be acceptable because such uses are taken to be abnormal.

Escape characters

One of the commonest tricks provided is a special escape character which forces the system to accept as text any character it precedes. The Logo PLUS escape character is the backslash.

Using backslash, you can, for example get Logo to accept a space as a character within a word:

make "funny.word "one\ word
pr :funny.word
pr count :funny.word
The value of :funny.word is an 8-character sequence one<space>word.

Notice that the backslash itself is not part of the word. If you need to include a backspace in a word you must precede it by a backspace. This is how you set up a variable with one backspace as its value:

make "funny.word "\\
pr :funny.word
pr count :funny.word
Backspace can be used to force lowercase, but you will need to remember that it only forces a special reading on the one immediately following character. To set up a name like Ron with a capital at the beginning, you will need to use two backslashes:

make "myname "R\o\n
pr :myname
This feels odd because it is the capital which is the Logo default, whereas your keyboard normally make you work harder (using the shift key) when you need capitals. For this reason, it makes no difference if you set up "myname as follows:

make "myname "r\o\n
pr :myname


Logo PLUS provides another way to handle mixed case character sequences through the implementation of a new object type,distinct from words and lists, called the string.

In most respects, aside from their acceptance of special characters without backslashing, strings behave like words. They look different, however. Strings are preceded and followed by the backquote character. (Empty strings are represented by two backquotes). This is a string:

`I am a string`

Clearly this helps considerably in those situations where lowercase is needed to improve the appearance of the display output. There is a price to pay, of course. Some new primitives are need to handle strings. (Look up string and string? in the primitives list in the appendix.) But the price is, in fact, not great because the specifically string handling primitives parallel those for words quite straightforwardly and the general object processing primitives - like first, count etc. - accept strings just as they do words. You will see that you can even concatenate strings using the primitive word (which forces a backslashed re-interpretation).

Ron Brasington
Department of Linguistic Science
The University of Reading

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