Next: Flowcharts and Recursion Up: Recursive Functions of Symbolic Previous: The LISP Programming System

# Another Formalism for Functions of Symbolic Expressions

There are a number of ways of defining functions of symbolic expressions which are quite similar to the system we have adopted. Each of them involves three basic functions, conditional expressions, and recursive function definitions, but the class of expressions corresponding to S-expressions is different, and so are the precise definitions of the functions. We shall describe one of these variants called linear LISP.

The L-expressions are defined as follows:

1. A finite list of characters is admitted.

2. Any string of admitted characters in an L-expression. This includes the null string denoted by .

There are three functions of strings:

1. is the first character of the string .

is undefined. For example:

2. is the string of characters which remains when the first character of the string is deleted.

is undefined. For example:

3. is the string formed by prefixing the character to the string . For example:

There are three predicates on strings:

1. , is a single character.

2. , is the null string.

3. , defined for and characters.

The advantage of linear LISP is that no characters are given special roles, as are parentheses, dots, and commas in LISP. This permits computations with all expressions that can be written linearly. The disadvantage of linear LISP is that the extraction of subexpressions is a fairly involved, rather than an elementary, operation. It is not hard to write, in linear LISP, functions that correspond to the basic functions of LISP, so that, mathematically, linear LISP includes LISP. This turns out to be the most convenient way of programming, in linear LISP, the more complicated manipulations. However, if the functions are to be represented by computer routines, LISP is essentially faster.

Next: Flowcharts and Recursion Up: Recursive Functions of Symbolic Previous: The LISP Programming System
John McCarthy
2006-08-13