An Introduction to the Apple Language for Calculator Users

Source: Jef Raskin, "An Introduction to the Apple Language for Calculator Users" (20 October 1979)-- in "The Macintosh Project: Selected Papers from Jef Raskin (First Macintosh Designer), Circa 1979," document 16, version 0.
Location: M1007, Apple Computer Inc. Papers, Series 3, Box 10, Folder 1.

1. Apple is Just Like a Calculator (but, oh, what a calculator).

Picture a small calculator. There is one number that you can see displayed at the top at the top of the calculator: we will call that number the "result". On a calculator you press the equal sign or a button marked "ENTER" to let it know that you a refinished typing for the moment and want to see a result. On the computer, you press the button marked "RETURN".

Since this is a written document and not an animated presentation, we will need some way to show when you press the return button. So, whenever you must press it, we will have the symbol


When the computer presents an result, we will just write the result on a line by itself. For example, if the answer was 98.6, we would show it as


You can tell that the computer produced this number since it is not followed by a [RETURN]. We are now ready to begin.

Unless the computer is in the process of displaying a result, it is waiting for you to type your request. Like a calculator, it is always ready, unless it isn't plugged in.

For reassurance, the computer displays an exclamation point (!) when it expects you to type something. A dialog between you and the computer will be presented in this document in the style of this example:

2+3 [RETURN]


In this example you typed the first line, and the computer responded by typing the single number 5.

The simplest example is where you type a number, and the computer responds with the same number. This example shows that decimal points are permissible.

56.21 [RETURN]


If you want to add 2 to this, you can type

+ 2 [RETURN]

and the computer will respond


You can do subtraction

- .21 [RETURN]


and multiplication

* 20 [RETURN]


and division

/40 [RETURN]


Let's add one



and then, since this is a scientific style calculator, take the sine of this quantity



Or, you could do this all at once, instead of a step at a time

56.21 + 2 -.21 * 20 / 40 + 1 SIN [RETURN]


2. A Comparison with Some Other Common Methods of Writing Expressions

An essay for experts.

In ordinary computer languages, a combination of operations and numbers (or names that stand for numbers) is called an expression. The same is true here. The difference is that the expression above would be written

SIN (((56.21 + 2 -.21) * 20 / 40) + 1)

in most computer languages. The reason it is different here is that this language is much simpler, and works like a calculator. You do not have to remember any rules but one: START AT THE LEFT, AND WORK TO THE RIGHT. You can use parentheses if you wish, but there are no "hierarchies of operators" to remember. To write an expression to solve a problem, just ask yourself what is to be done from first to last, and then type it in--in that order.

In RPN (Reverse Polish Notation), used in some calculators, the expression is

56.21 E 2 + .21 - 20 * 40 / 1 + SIN

where E is the "enter" button.

In APL (Iverson's "A Programming Language") it is (since this font doesn't have the proper division sign, forgive us for using $ for division in this case)

lo(((56.21 + 2 - .21)X 20 $ 40) + 1)

lo is how APL indicates the SIN function.

The usual hierarchical schemes begin to collapse when the number of operators gets great. For example, in Nicklaus Wirth's Pascal language, the expression

3 + 4 > 8

is ill-formed, since the logical operators have higher precedence and you can't add 3 to FALSE. But in most BASICs (Beginner's All-purpose Symbolic Instruction Code, by Kemeny and Kurtz) that same expression is legal, and evaluates to FALSE since arithmetic operators have higher precedence. The only precedent (using the word in its legal sense) for hierarchy in operators comes from mathematics where there is only the precedence of multipication and division over addition and subtraction. It arose there only as a shorthand. As RPN, APL and this Apple language have found, the elimination of hierarchies of precedence contributes greatly to readability, simplicity memorability and consistency of a language. It also makes expressions shorter, and easier to type.

3. Document 14 contains the full details of the rest of the Apple language. This document demonstrates how easily the Apple language can be introduced to users of calculators, and gives a comparison of various methods of expressions.

An article by Backus in a recent Communications of the ACM (Backus of BNF fame, now employed by IBM in San Jose) points out that expressions are easier to comprehend than programs. He suggests that the languages of the future will have their structure embedded in expressions, and points to APL as being a step in that direction. Apple does not extend the power of expressions beyond the scope of APL's uses of expressions, and does not forward Backus' ideas. It just makes these ideas more accessible.

Document created on 6 June 2000;