Here's part of "The Secret Guide to Computers," copyright by Russ Walter, 29th edition. For newer info, read the 33rd edition at

Exotic languages

You’ve already learned the most popular computer languages: QBASIC, Visual BASIC, PASCAL, C, C++, Java, and DBASE. But those 9 languages are just the tip of the iceberg. Programmers have invented thousands of others.



Here’s a multilingual dictionary that lets you translate 19 languages. For example, it shows that QBASIC says “DIM x(4)” but FORTRAN says “DIMENSION X(4)” instead.


│QBASIC      │DIM x(4)                    FOR i = 5 TO 17                                  fred           GOTO 50      │

│Visual BASIC│Dim x(4)                    For i = 5 To 17                                  fred           GoTo gail    │

│FORTRAN     │DIMENSION X(4)              DO 10 I=5,17                                     CALL FRED      GO TO 50     │

│PL/I        │DECLARE X(4)                DO I = 5 TO 17                                   CALL FRED      GO TO GAIL   │

│            │                                                                                                         │

│ALGOL       │REAL ARRAY X[1:4]           FOR I := 5 STEP 1 UNTIL 17 DO                    FRED           GO TO GAIL   │

│PASCAL      │X: ARRAY[1..4] OF REAL      FOR I := 5 TO 17 DO                              FRED           GOTO 50      │

│MODULA      │X: ARRAY[1..4] OF REAL      FOR I := 5 TO 17 DO                              FRED           not available│

│ADA         │X: ARRAY(1..4) OF FLOAT     FOR I IN 5..17 LOOP                              FRED           GO TO GAIL   │

│            │                                                                                                         │

│C           │float x[4]                  for (i=5; i<=17; ++i)                            fred()         goto gail    │

│C++         │float x[4]                  for (int i=5; i<=17; ++i)                        fred()         goto gail    │

│Java        │float[] x=new float x[4]    for (int i=5; i<=17; ++i)                        fred()         not available│

│JavaScript  │x=Array(4)                  for (int i=5; i<=17; ++i)                        fred()         not available│

│            │                                                                                                         │

│EASY        │PREPARE X(4)                LOOP I FROM 5 TO 17                              FRED           SKIP TO GAIL │

│DBASE       │DECLARE X[4]                not available                                    DO FRED        not available│


│            │                                                                                                         │

│LOGO        │DEFAR "X 4 1                not available                                    FRED           GO "GAIL     │

│LISP        │(ARRAY ((X (4) LIST)))      not available                                    (FRED)         (GO GAIL)    │

│SNOBOL      │X = ARRAY(4)                not available                                    FRED()         :(GAIL)      │

│PILOT       │DIM:#X(4)                   not available                                    U:FRED         J:*GAIL      │




│QBASIC      │IF x = 4.3 THEN      INPUT k               j = k + 2           PRINT k               'silly stuff        │

│Visual BASIC│If x = 4.3 Then      k = Val(InputBox("")) j = k + 2           Print k               'silly stuff        │

│FORTRAN     │IF (X .EQ. 4.3)      READ *, K             J=K+2               PRINT *, K            C  SILLY STUFF      │

│PL/I        │IF X=4.3 THEN        GET LIST(K)           J=K+2               PUT LIST(K)           /* SILLY STUFF */   │

│            │                                                                                                         │

│ALGOL       │IF X=4.3 THEN        READ(K)               J:=K+2              PRINT(K)              COMMENT  SILLY STUFF│

│PASCAL      │IF X=4.3 THEN        READ(K)               J:=K+2              WRITELN(K)            {SILLY STUFF}       │

│MODULA      │IF X=4.3 THEN        READINTEGER(K)        J:=K+2              WRITEINTEGER(K,6)     (*SILLY STUFF*)     │

│ADA         │IF X=4.3 THEN        GET(K)                J:=K+2              PUT(K)                --SILLY STUFF       │

│            │                                                                                                         │

│C           │if (x==4.3)          scanf("%d",&k)        j=k+2               printf("%d",k)        /* silly stuff */   │

│C++         │if (x==4.3)          cin >>k               j=k+2               cout <<k              //silly stuff       │

│Java        │if (x==4.3)          k=Integer.parseInt(s) j=k+2               System.out.println(k) //silly stuff       │

│JavaScript  │if (x==4.3)          k=prompt("","")       j=k+2               document.write(k)     //silly stuff       │

│            │                                                                                                         │

│EASY        │IF X=4.3             GET K                 LET J=K+2           SAY K                 'SILLY STUFF        │

│DBASE       │IF X=4.3             INPUT TO K            J=K+2               ? K                   &&SILLY STUFF       │

│COBOL       │IF X = 4.3           ACCEPT K              COMPUTE J = K + 2   DISPLAY K             *SILLY STUFF        │

│            │                                                                                                         │

│LOGO        │IF :X=4.3            MAKE "K READWORD      MAKE "J :K+2        PRINT :K              !SILLY STUFF        │

│LISP        │(COND ((EQUAL X 4.3) (SETQ K (READ))       (SETQ J (PLUS K 2)) K                     ;SILLY STUFF        │

│SNOBOL      │EQ(X,4.3) :S(        K = INPUT             J = K + 2           OUTPUT = K            *SILLY STUFF        │

│PILOT       │(#X=4.3)             A:#K                  C:#J=#K+2           T:#K                  R:SILLY STUFF       │


The dictionary clumps the languages into groups. For example, look at the languages in the second group: ALGOL, PASCAL, MODULA, and ADA. Those 4 languages are almost identical to each other. For example, in each of them you say “J:=K+2”.

The bottom group (LOGO, LISP, SNOBOL, and PILOT) differs wildly from the others. For example, look at how those 4 languages translate “IF x = 4.3 THEN” and “j = k + 2”. They’re called radical languages; the other 15 languages are called mainstream.

Two other radical languages are APL and FORTH. They’re so weird that they won’t fit in that chart!

Here’s how to make the computer do 2+2 and print the answer (4), using each of those languages:

QBASIC         LOGO             EASY           DBASE    APL   JavaScript                       LISP                  FORTH        SNOBOL                      PILOT    x

PRINT 2 + 2 PRINT 2+2 SAY 2+2   ? 2+2 2+2 document.write(2+2)  (PLUS 2 2)   2 2 + .     OUTPUT = 2 + 2   C:#N=2+2

                                                                                 END             T:#N

ALGOL           PASCAL            Visual BASIC                          FORTRAN      PL/I                                                       ADA                         x

BEGIN      BEGIN        Private Sub Form_Load()   N=2+2      HARRY:  PROCEDURE OPTIONS(MAIN);  PROCEDURE HARRY IS

PRINT(2+2); WRITELN(2+2); Print 2 + 2            PRINT *, N           PUT LIST(2+2);           BEGIN

END          END.         End Sub                 END                  END;                     PUT(2+2);


C++                               C                           MODULA                        Java                                                             COBOL                          x

#include <iostream.h>  #include <stdio.h>  MODULE HARRY;        public class Class1                  IDENTIFICATION DIVISION.

void main()         void main()        FROM INOUT          {                                DATA DIVISION.

{                  {                 IMPORT WRITEINTEGER;   public static void main (String[] args) WORKING-STORAGE SECTION.

  cout <<2+2;          printf("%d",2+2); BEGIN                 {                                 01     N PIC 9.

}                  }               WRITEINTEGER(2+2,6);        System.out.println(2+2);         PROCEDURE DIVISION.

                                  END HARRY.             }                                 MAIN-ROUTINE.

                                                     }                                        ADD 2 2 GIVING N.

                                                                                               DISPLAY N.

                                                                                              STOP RUN.

Notice that APL’s the briefest (just say 2+2), and COBOL’s the most verbose (it requires 9 lines of typing).

Each of those 20 languages is flexible enough to program anything. Which language you choose is mainly a matter of personal taste.

Other languages are more specialized. For example, a language called “GPSS” is designed specifically to analyze how many employees to hire, to save your customers from waiting in long lines for service. DYNAMO analyzes social interactions inside your company and city and throughout the world; then it graphs your future. SPSS analyzes tables of numbers, by computing their averages, maxima, minima, standard deviations, and hundreds of other measurements used by statisticians. APT helps you run a factory by controlling “robots” that cut metal. PROLOG lets you store answers to your questions and act as an expert system. RPG spits out long business reports for executives who don’t have enough time to program in COBOL.

The following table reveals more details about all those languages. Within each category (“mainstream”, “radical”, and “specialized”), the table lists the languages in chronological order. QBASIC and Visual BASIC are considered variants of BASIC.

Name         What the name stands for              Original use           Version 1 arose at         When         Names of new versions

                    Mainstream languages

FORTRAN   FORmula TRANslating                            sciences                        IBM                                    1954-1957   FORTRAN 90, Lahey FORTRAN

ALGOL    ALGOrithmic Language                              sciences                        international                           1957-1958   ALGOL W, ALGOL 68, BALGOL

COBOL    COmmon Business-Oriented Language     business                     Defense Department           1959-1960   COBOL 85

BASIC          Beginners All-purp. Symbolic Instruc. Code    sciences                        Dartmouth College           1963-1964   QBASIC, Visual BASIC

PL/I             Programming Language One                       general                          IBM                                    1963-1966   PL/I Optimizer, PL/C, ANSI PL/I

PASCAL      Blaise PASCAL                                           general                          Switzerland                          1968-1970   Turbo PASCAL, DELPHI

MODULA    MODULAr programming                        systems programming   Switzerland                          1975            MODULA-2, OBERON

C                  beyond B                                                    systems programming   Bell Labs                             1971-1973   ANSI C

ADA            ADA Lovelace                                            military equipment    France                                 1977-1980   ADA final version

DBASE        Data BASE                                                 database management   Jet Prop’n Lab & Ashton-T.   1978-1980   Visual DBASE 7.5, Visual FOXPRO 7

EASY       EASY                                                      general                          Secret Guide                     1972-1982   EASY

C++              C increased                                                 systems programming   Bell Labs                             1979-1983   Visual C++, Borland C++, ISO C++, C#

Java             as stimulating as Java coffee                       Web-page animation     Sun Microsystems                1990-1995   Java 2, J2EE, Visual J++, JBuilder, J#

JavaScript    Java for creating simple scripts                   Web-page calculations   Netscape                             1996            JScript

                    Radical languages

LISP            LISt Processing                                           artificial intelligence     MIT                                    1958-1960   Common LISP

SNOBOL      StriNg-Oriented symBOlic Language        string processing        Bell Labs                             1962-1963   SNOBOL 4B

APL             A Programming Language                           sciences                        Harvard & IBM                   1956-1966   APLSV, APL PLUS, APL 2, J

LOGO          LOGO                                                         general                          Bolt Beranek Newman         1967            Terrapin LOGO, LCSI MicroWorlds Pro

FORTH        FOuRTH-generation language                  business & astronomy   Stanford Univ. & Mohasco  1963-1968   FORTH 83, FIG-FORTH, MMS FORTH

PILOT         Programmed Inquiry, Learning, Or Teaching  tutoring kids              U. of Cal. at San Francisco  1968            Atari PILOT

                    Specialized languages

APT            Automatically Programmed Tools           cutting metal                MIT                                    1952-1957   APT 77

DYNAMO   DYNAmic Models                                   simulation                    MIT                                    1959            DYNAMO 3, STELLA

GPSS            General-Purpose Simulation System         simulation                     IBM                                    1961           GPSS 5

RPG             Report Program Generator                         business                     IBM                                    1964            RPG 3

SPSS             Statistical Package for the Social Sciences   statistics                       Stanford University             1965-1967   SPSS 10

PROLOG     PROgramming in LOGic                             artificial intelligence     France                                 1972            Arity PROLOG, Turbo PROLOG

Of those 26 languages, 5 were invented in Europe (ALGOL, PASCAL, MODULA, ADA, and PROLOG). The others were invented in the United States.

5 were invented at IBM’s research facilities (FORTRAN, PL/I, APL, GPSS, and RPG), 3 at MIT (LISP, APT, and DYNAMO), 3 at Bell Labs (C, C++, and SNOBOL), 2 at Stanford University (FORTH and SPSS), and 2 by Professor Niklaus Wirth in Switzerland (PASCAL and MODULA). The others were invented by geniuses elsewhere.

Mainstream languages

The first mainstream languages were FORTRAN, ALGOL, and COBOL. They were the big 3.

FORTRAN appealed to engineers, ALGOL to logicians, and COBOL to business managers & government bureaucrats. FORTRAN was invented by IBM, ALGOL by an international committee, and COBOL by a committee based at the Pentagon.

Beyond the big 3

Other mainstream languages came after the big 3 and were just slight improvements of the big 3. This family tree shows how the mainstream languages influenced each other:

FORTRAN (1957)



PL/I (1966)     ALGOL (1958)                                                                                      COBOL (1960)



                       PASCAL (1970)                               C (1973)         BASIC (1964)



                       MODULA (1975)     ADA (1980)    C++ (1983)     EASY (1982)      DBASE (1980)



                                                                                Java (1995)



                                                                                JavaScript (1996)

In that tree, a vertical line means “a direct influence” (like a parent); a slanted line means “an indirect influence” (like an aunt or uncle). For each language, I show the year when the language’s first version was complete. As each language grew, it stole features from other languages (just like English stole the word “restaurant” from French); the tree shows just history’s main thrust. Now let’s dig into the details.…

Why BASIC? Two professors at Dartmouth College combined FORTRAN with ALGOL, to form BASIC. It was designed for students, not professionals: it included just the easiest parts of FORTRAN and ALGOL. Students liked it because it was easy to learn, but professionals complained it lacked advanced features.

Why PL/I? After inventing FORTRAN and further improvements (called FORTRAN II, FORTRAN III, FORTRAN IV, and FORTRAN V), IBM decided to invent the “ultimate” improvement: a language that would include all the important words of FORTRAN V and ALGOL and COBOL. At first, IBM called it “FORTRAN VI”; but since it included the best of everything and was the first complete language ever invented, IBM changed its name to Programming Language One (written as PL/I). IBM bragged about how PL/I was so eclectic, but most programmers considered it a confusing mishmash and continued using the original three languages (FORTRAN, ALGOL, and COBOL), which were pure and simple.

Why PASCAL and MODULA? Among the folks who disliked PL/I was Niklaus Wirth, who preferred ALGOL. At a Swiss university, he invented an improved ALGOL and called it PASCAL. Then he invented a further improvement, called MODULA. ALGOL, PASCAL, and MODULA are all very similar to each other. He thinks MODULA’s the best of the trio, but critics disagree. Today, PASCAL is still the most popular of that trio; hardly anybody uses the original ALGOL anymore, and MODULA is considered a controversial experiment.

While Wirth was developing and improving MODULA, other researchers were developing four competitors: C, ADA, DBASE, and EASY. Here’s why.…

Why C? Fancy languages, such as PL/I and MODULA, require lots of RAM. At Bell Labs, researchers needed a language small enough to fit in the tiny RAM of a minicomputer or microcomputer. They developed the ideal tiny language and called it C. Like PL/I, it borrows from FORTRAN, ALGOL, and COBOL; but it lacks PL/I’s frills. It’s “lean and mean” and runs very quickly. Later, Bell Telephone Labs invented an improved C, called C++, which includes extra commands. Then Sun invented a C++ variant, called Java, to handle animation on Web pages.

Why ADA? The Department of Defense, which was happily using COBOL to run the military’s bureaucracy, needed to invent a second kind of language, to control missiles and other military equipment. The Department held a contest to develop such a language and said it wanted the language to resemble PL/I, ALGOL, and PASCAL. (It didn’t know about MODULA, which was still being developed.) The winner was a French company. The Department adopted that company’s language and called it ADA. It resembled MODULA but included more commands — and therefore consumed more RAM and was more expensive. Critics complain that ADA, like PL/I, is too large and complex.

Why DBASE? Inspired by languages such as BASIC and PL/I, Wayne Ratliff invented DBASE. Like BASIC, DBASE is easy; like PL/I and PASCAL, DBASE creates loops by saying WHILE instead of GO TO. What makes DBASE unique is its new commands for manipulating databases.

Why EASY? My own attempt to create the ideal language is called EASY. It’s even easier to learn than BASIC, yet includes the power of languages such as PASCAL. But since I don’t have the time to put EASY onto a computer, EASY’s remained just an idea whose time should have come.

Dig in! Here are the inside secrets about all those mainstream languages.…


During the early 1950’s, the only available computer languages were specialized or awkward. FORTRAN was the first computer language good enough to be considered mainstream. ALGOL and COBOL came shortly afterwards. FORTRAN, ALGOL, and COBOL were so good that they made all earlier languages obsolete.

FORTRAN’s nature On pages 365-461, I explained how to program in QBASIC. FORTRAN resembles QBASIC but is weirder — because FORTRAN was invented before programmers learned how to make programming languages pleasant.

For example, suppose you want to add 2+2. In QBASIC, you can say just:


In FORTRAN, you must lengthen the program, so it looks like this instead:


      PRINT *, N


Here’s why:

FORTRAN requires the program’s bottom line to say END.

FORTRAN requires each line to be indented 6 spaces.

FORTRAN is too stupid to do math in the middle of a PRINT statement, so you must do the math first, in a separate line (N=2+2).

FORTRAN expects you to comment about how to print the answer. If you have no comment on that topic, put an asterisk and comma in the PRINT statement. The asterisk and comma mean: no comment.

That’s how the typical version of FORTRAN works. Some versions are different. For example, some versions require you to say STOP above END, like this:


      PRINT *, N



Some versions want you to say TYPE instead of PRINT.

Some old versions won’t accept “no comment” about printing. They require you to say:


      PRINT 10, N

10    FORMAT (1X,I1)


That PRINT line means: PRINT, using the FORMAT in line 10, the value of N. In line 10, the 1X means “normal”; the I1 means “an integer that’s just one digit”. Those details drive beginners nuts, but experienced FORTRAN programmers are used to such headaches and take them in stride, just like Frenchmen are used to conjugating French verbs and Germans are used to conjugating German adjectives (yuck!).

Like QBASIC, FORTRAN lets you do math by using these symbols:

+   -   *   /

In QBASIC, if you want to divide 399 by 100, requesting 399/100 makes the computer gives you the correct answer, 3.99. But in FORTRAN, requesting 399/100 makes the computer assume you don’t care about decimal points (since you didn’t mention any), so it says just 3; if you want it to say 3.99 instead, you must insert a decimal point into the original problem, by asking for 399.0/100.0 (or at least asking for 399./100, if you’re lazy).

In QBASIC, you can use the symbol < to mean “less than”. FORTRAN is afraid to use fancy symbols (since ancient computers didn’t understand them), so FORTRAN wants you to write .LT. instead, like this:

QBASIC:         IF x < 4.3 THEN

FORTRAN:     IF (X .LT. 4.3) THEN

Likewise, FORTRAN requires you to say .GT. instead of > for “greater than”, say .LE. for “less than or equal to”, say .GE. for “greater than or equal to”. To be consistent, FORTRAN also requires you to say .EQ. instead of “equal to” (in an IF statement):

QBASIC:         IF x = 4.3 THEN

FORTRAN      IF (X .EQ. 4.3) THEN

In QBASIC, the symbol ^ means exponents (for example,
4.7 ^ 3 means “4.7 times 4.7 times 4.7”). Since FORTRAN is afraid of fancy symbols, FORTRAN uses ** instead of ^ (like this: 4.7 ** 3).

In QBASIC, a variable can be any letter of the alphabet (such as n) or a longer name (up to 40 characters long). In FORTRAN, each variable’s name must be short (no longer than 6 characters), because FORTRAN is supposed to run even on primitive old computers that have very little memory.

QBASIC can handle 5 kinds of variables: single-precision real, double-precision real, short integer, long integer, or string. QBASIC assumes each variable is single-precision real, unless you specifically indicate otherwise (such as by putting a $ at the end of the variable’s name, to indicate the variable’s a string).

In QBASIC, every variable stands for a single-precision real number, unless you specifically say otherwise. For example, putting $ after the variable’s name makes the variable become a string instead. QBASIC can handle 5 kinds of variables: single-precision real number, string, double-precision real number, short integer, and long integer.

Mathematicians (and engineers) often use the letters i, j, k, m, and n to stand for integers. FORTRAN therefore assumes that any variable whose name begins with I, J, K, L, M, or N is an integer, and all other variables are single-precision real, unless you specifically say otherwise.

FORTRAN can handle 4 kinds of variables: single-precision real (which FORTRAN calls REAL), double-precision real (which FORTRAN calls DOUBLE PRECISION), long integer (which FORTRAN calls INTEGER), and complex numbers (which FORTRAN calls COMPLEX and include numbers such as the square root of -1). FORTRAN’s ability to handle COMPLEX numbers make it better for advanced math & engineering than QBASIC.

Since FORTRAN assumes that variables beginning with I, J, K, L, M, or N are integers, FORTRAN programmers purposely misspell variable names. For example, if a FORTRAN variable’s purpose is to count, call it KOUNT (rather than COUNT) to make it an INTEGER. If you want a FORTRAN variable to be an integer that measures a position, call it LOCATN (rather than POSITN) to make it an INTEGER. If a FORTRAN variable measures an object’s mass as a real number, call it AMASS (rather than MASS) to make it a REAL.

Since FORTRAN’s purpose was just to do math, FORTRAN’s original version didn’t include any string variables. Later, many manufacturers tried to “fix” FORTRAN by adding string commands, but those commands are awkward and pathetic, much worse than what QBASIC offers.

FORTRAN did a good job of handling math functions (such as SQR) and subroutines (for handling statistics, calculus computations, and other math challenges). Many programmers created libraries full of math functions and subroutines and sold them to other programmers. A whole culture developed of programmers writing FORTRAN routines. If you didn’t know FORTRAN, you weren’t part of the “in” crowd.

How FORTRAN arose In 1954, an IBM committee said it was planning a new computer language that would help engineers make the computer handle math formulas. The committee called the language FORTRAN, to emphasize that the language would be particularly good for TRANslating FORmulas into computer notation.

Those original plans for FORTRAN were modest:

They did not allow long variable names, subroutines, long function definitions, double precision, complex numbers, or apostrophes. A variable’s name had to be short: just two letters. A function’s definition had to fit on a single line. To print ‘PLEASE KISS ME’, the programmers had to write that string as 14HPLEASE KISS ME instead of ‘PLEASE KISS ME’; the 14H warned the computer that a 14-character string was coming.

Then came improvements:

The first working version of FORTRAN (1957) allowed longer variable names: up to 6 characters.

FORTRAN II (1958) allowed subroutines and long function definitions.

IBM experimented with FORTRAN III but never released it to the public.

FORTRAN IV (1962) allowed double precision and complex numbers.

Apostrophes around strings weren’t allowed until later.

The original plans said you’d be able to add an integer to a real. That didn’t work in FORTRAN I, FORTRAN II, and FORTRAN IV, but it works today.

The original plans said an IF statement would compare any two numbers. FORTRAN I and FORTRAN II required the second number to be zero, but FORTRAN IV removed that restriction.

IBM waged a campaign to convince everyone that FORTRAN was easier than previous methods of programming. IBM succeeded: FORTRAN became immediately popular. FORTRAN was easy enough so that, for the first time, engineers who weren’t computer specialists could write programs.

Other manufacturers sold imitations of IBM’s FORTRAN, but with modifications. The variety of modifications from all the manufacturers annoyed engineers, who wished manufacturers would all use a single, common version of FORTRAN. So the engineers turned to the American National Standards Institute (ANSI), which is a non-profit group of engineers that sets standards.

“ANSI” is pronounced “an see”. It sets standards for practically all equipment in your life. For example, ANSI sets the standard for screws: to tighten a screw, you turn it clockwise, not counterclockwise.

In 1966, ANSI decided on a single version of FORTRAN IV to be used by all manufacturers. Thereafter, each manufacturer adhered to the ANSI standard but also added extra commands, to try to outclass the other manufacturers.

After several years had gone by, enough extra commands had been added by manufacturers so engineers asked ANSI to meet again and develop a common standard for those extras. ANSI finished developing the standard in 1977 and called it FORTRAN 77.

Now each major manufacturer adheres to the standard for FORTRAN 77, so you can run FORTRAN 77 programs on most maxicomputers, minicomputers, and microcomputers. Each manufacturer adds extra commands beyond FORTRAN 77.

In 1984, an ANSI committee developed a “FORTRAN 88”. 40 members of the committee approved it, but the other 2 members — IBM and DEC — refused to endorse it. In 1991, a variant called FORTRAN 90 was finally approved by all.

FORTRAN’s popularity FORTRAN became popular immediately because it didn’t have any serious competitors. Throughout the 1960’s and 1970’s, FORTRAN remained the most popular computer language among engineers, scientists, mathematicians, and college students. Colleges required all freshman computer-science majors to take FORTRAN.

But at the end of the 1970’s, FORTRAN’s popularity began to drop.

Engineers switched to newer languages, such as BASIC (which is easier), PASCAL (more logical), and C (faster and more economical of RAM). Although FORTRAN 77 included extra commands to make FORTRAN resemble BASIC and PASCAL, those commands were “too little, too late”: FORTRAN’s new string commands weren’t quite as good as BASIC’s, and FORTRAN’s new IF command wasn’t quite as good as PASCAL’s.

Now high-school kids are required to study BASIC or PASCAL, college kids are required to study C++, and hardly anybody studies FORTRAN. People who still program in FORTRAN are called “old-fashioned” by their colleagues.

But in some ways, FORTRAN’s still better for engineering that BASIC, PASCAL, or C++. Here’s why:

FORTRAN includes more commands for handling “complex numbers”.

FORTRAN programmers have developed libraries containing thousands of FORTRAN subroutines, which you can use in your own FORTRAN programs. Such large libraries haven’t been developed for BASIC, PASCAL, or C++ yet.

Though BASIC, PASCAL, and C++ work well on microcomputers and minicomputers, no good versions of those languages have been invented for IBM maxicomputers yet. The only language that lets you unleash an IBM maxicomputer’s full power to solve engineering problems is FORTRAN.


In 1955, a committee in Germany began inventing a computer language. Though the committee spoke German, it decided the computer language should use English words instead, since English was the international language for science.

In 1957 those Germans invited Americans to join them. In 1958 other European countries joined also, to form an international committee, which proposed a new computer language, called “IAL” (International Algebraic Language).

The committee eventually changed the language’s name to ALGOL 58 (the ALGOrithmic Language invented in 1958), then created an improved version called ALGOL 60, then created a further revision called ALGOL 60 Revised, and disbanded. Today, programmers who mention “ALGOL” usually mean the committee’s last report, ALGOL 60 Revised.

ALGOL differs from FORTRAN in many little ways.…

How to end a statement At the end of each statement, FORTRAN requires you to press the ENTER key. ALGOL requires you to type a semicolon instead.

ALGOL’s advantage: you can type many statements on the same line, by putting semicolons between the statements. ALGOL’s disadvantage: those ugly semicolons are a nuisance to type and make your program look cluttered.

Integer variables To tell the computer that a person’s AGE is an integer (instead of a real number), FORTRAN requires you to put the letter I, J, K, L, M, or N before the variable’s name, like this: IAGE. ALGOL requires you to insert a note saying “INTEGER AGE” at the top of your program instead.

ALGOL’s advantage: you don’t have to write unpronounceable gobbledygook such as “IAGE”. ALGOL’s disadvantage: whenever you create a new variable, ALGOL forces you to go back up to the top of your program and insert a line saying “INTEGER” or “REAL”.

Assignment statements In FORTRAN, you can say J=7. In ALGOL, you must insert a colon and say J:=7 instead. To increase K by 1 in FORTRAN, you say K=K+1. In ALGOL, you say K:=K+1.

ALGOL’s disadvantage: the colon is a nuisance to type. FORTRAN’s disadvantage: according to the rules of algebra, it’s impossible for K to equal K+1, and so the FORTRAN command K=K+1 looks like an impossibility.

ALGOL’s beauty Here’s how ALGOL avoids FORTRAN’s ugliness:

In ALGOL, a variable’s name can be practically as long as you like. In FORTRAN, a variable’s name must be short: no more than 6 characters.

ALGOL lets you write 2 instead of 2.0, without affecting the computer’s answer. In FORTRAN, if you write 1/2 instead of 1/2.0, you get 0 instead of .5; and if you write SQRT (9) instead of SQRT (9.0), you get nonsense.

ALGOL’s IF statement is very flexible: it can include the words ELSE, BEGIN, and END, and it lets you insert as many statements as you want between BEGIN and END. ALGOL even lets you put an IF statement in the middle of an equation, like this: X:=2+(IF Y<5 THEN 8 ELSE 9). The IF statement in FORTRAN I, II, III, and IV was very limited; the IF statement in FORTRAN 77 copies some of ALGOL’s power, but not yet all.

ALGOL’s FOR statement is very flexible. To make X be 3.7, then be Y+6.2, then go from SQRT(Z) down to 5 in steps of .3, you can say “FOR X:=3.7, Y+6.2, SQRT(Z) STEP -.3 UNTIL 5 DO”. FORTRAN’s DO is more restrictive; some versions of FORTRAN even insist that the DO statement contain no reals, no negatives, and no arithmetic operations.

At the beginning of a FORTRAN program, you can say DIMENSION X(20) but not DIMENSION X(N). ALGOL permits the “DIMENSION X(N)” concept; in ALGOL you say ARRAY X[1:N].

ALGOL’s popularity When ALGOL was invented, programmers loved it. Europeans began using ALGOL more than FORTRAN. The American computer association (called the Association for Computing Machinery, ACM) said all programs in its magazine would be in ALGOL.

But IBM refused to put ALGOL on its computers. Since most American programmers used IBM computers, most American programmers couldn’t use ALGOL.

That created a ridiculous situation: American programmers programmed in FORTRAN instead, but submitted ALGOL translations to the ACM’s magazine, which published the programs in ALGOL, which the magazine’s readers had to translate back to FORTRAN in order to run on IBM computers.

IBM computers eventually swept over Europe, so that even Europeans had to use FORTRAN instead of ALGOL.

In 1966 the ACM gave in and agreed to publish programs in FORTRAN. But since ALGOL was prettier, everybody continued to submit ALGOL versions anyway.

IBM gave in also and put ALGOL on its computers. But IBM’s version of ALGOL was so limited and awkward that nobody took it seriously, and IBM stopped selling it and supporting it.

In 1972 Stanford University created ALGOL W, a better version that ran on IBM computers. But ALGOL W came too late: universities and businessmen had already grown tired of waiting for a good IBM ALGOL and had committed themselves to FORTRAN.

Critics blamed IBM for ALGOL’s demise. But here’s IBM’s side of the story:

IBM had invested 25 man-years to develop the first version of FORTRAN. By the time the ALGOL committee finished the report on ALGOL 60 Revised, IBM had also developed FORTRAN II and FORTRAN III and made plans for FORTRAN IV. IBM was proud of its FORTRANs and wanted to elaborate on them. Moreover, IBM realized that computers run FORTRAN  programs more quickly than ALGOL.

When asked why it didn’t support ALGOL, IBM replied that the committee’s description of ALGOL was incomplete. IBM was right; the ALGOL 60 Revised Report has three loopholes:

1. The report doesn’t say what words to use for input and output, because the committee couldn’t agree. So computers differ. If you want to transfer an ALGOL program from one computer to another, you must change all the input and output instructions.

2. The report uses symbols such as ¸ and Ù, which most keyboards lack. The report underlines keywords; most keyboards can’t underline. To type ALGOL programs on a typical keyboard, you must substitute other symbols for ¸, Ù, and underlining. Here again, manufacturers differ. To transfer an ALGOL program to another manufacturer, you must change symbols.

3. Some features of ALGOL are hard to teach to a computer. Even now, no computer understands all of ALGOL. When a manufacturer says its computer “understands ALGOL”, you must ask, “Which features of ALGOL?”

Attempts to improve ALGOL Long after the original ALGOL committee wrote the ALGOL 60 Revised Report, two other ALGOL committees were formed.

One committee developed suggestions on how to do input and output, but its suggestions were largely ignored.

The other committee tried to invent a much fancier ALGOL. That committee wrote its preliminary report in 1968 and revised it in 1975. Called ALGOL 68 Revised, that weird report requires you to spell words backwards: to mark the end of the IF statement, you say FI; to mark the end of the DO statement, you say OD. The committee’s decision was far from unanimous: several members refused to endorse the report.

ALGOL today Few programmers still use ALGOL, but many use PASCAL (which is very similar to ALGOL 60 Revised) and BASIC (which is a compromise between ALGOL and FORTRAN).


If you’re a students who’s going to give a speech or write a paper, teachers recommend that you organize your thinking by creating an outline. Back in the 1950’s, administrators who manage computer departments got together and decided that programmers should organize programs in the same way: by creating an outline before writing the program, especially since a well-organized program is easier to analyze and improve (after the original programmer gets fired).

Those administrators invented a computer language that lets the programmer just fill in an outline and feed the outline to the computer. The outline itself would act as the program. No further programming would be necessary.

That outline-oriented computer language would be used especially for handling tough programming problems in business accounting (such as payroll, inventory, accounts payable, and accounts receivable), so it was called the COmmon Business Oriented Language (whose abbreviation is COBOL, which is pronounced “koe ball”).

Four parts To write a program in COBOL, you just fill in an outline, which has four parts:

In the first part, called the IDENTIFICATION DIVISION, you give your name (so your boss knows who to fire when the program doesn’t work) and make additional comments about when the program was written, the program’s name, and security (who’s allowed to see this program). The computer ignores everything you say in the IDENTIFICATION DIVISION, but writing such stuff makes your boss happy.

In the second part, called the ENVIRONMENT DIVISION, you say what kind of environment the program was written for: which computer it runs on, which devices the program’s files use (disks? tapes? printers? punched cards?), and whether decimal points should be written as commas instead (since people in France, Italy, and Germany want you to do that).

In the third part, called the DATA DIVISION, you list all the program’s variables. For each numeric variable, you say how many digits it should store (to the left and right of the decimal point) and how the number should be formatted (for example, say whether to put a dollar sign before the number). For example, if you want N to be a simple 3-digit integer (from 000 to 999), with no special formatting, say N PICTURE IS 999 (which means N is a variable whose picture is at most the number 999). If you want N to be a simple 7-digit integer (from 0000000 to 9999999), say N PICTURE IS 9999999. If you want N to be a simple 7-character string, say N PICTURE IS XXXXXXX. You can abbreviate: you can say just PIC instead of PICTURE IS, and you can say X(7) instead of XXXXXXX.

In the fourth and final part, called the PROCEDURE DIVISION, you finally write the procedures that you want to the computer to perform, using commands such as READ, WRITE, DISPLAY, ACCEPT, IF, GO TO, SORT, MERGE, and PERFORM. Each command is an English sentence that includes a verb and ends in a period. You organize the PROCEDURE DIVISION into paragraphs, invent a name for each paragraph, treat each paragraph as a separate procedure/subroutine, and tell the computer in what order to PERFORM the paragraphs. One line in the PROCEDURE DIVISION must say “STOP RUN”: when the computer encounters that line, the computer stops running the program.

Unfortunately, that idea of dividing a program into 4 divisions is wrong-headed: when you write or read a COBOL program, your eye must keep hopping between the divisions to find out what kind of variable the procedure involves and which computer device the variable is being stored on.

Although creating such an outline is a cute idea, it doesn’t work very well: when you write a COBOL program, your eye must keep hopping between the PROCEDURE DIVISION (where the action is) and the DATA DIVISION (which tells what the variables mean), while taking an occasional peek at the ENVIRONMENT DIVISION (which tells what devices are involved). Other programming languages, developed later, use better methods for organizing thoughts.

How COBOL arose During the 1950’s, several organizations developed languages to solve problems in business. The most popular business languages were IBM’s COMMERCIAL TRANSLATOR (developed from 1957-1959), Honeywell’s FACT (1959-1960), Sperry Rand’s FLOW-MATIC (1954-1958), and the Air Force’s AIMACO (1958).

In April 1959, a group of programmers and manufacturers met at the University of Pennsylvania and decided to develop a single business language for all computers. The group asked the Department of Defense to help sponsor the research.

The Department agreed. At a follow-up meeting held at the Pentagon in May. At that meeting, the group tentatively decided to call the new language “CBL” (for “Common Business Language”) and created three committees.

The Short-Range Committee would meet immediately to develop a temporary language. A Medium-Range Committee would meet later to develop a more thoroughly thought-out language. Then a Long-Range Committee would develop the ultimate language.

The Short-Range Committee met immediately and created a language nice enough so that the Medium-Range and Long-Range Committees never bothered to meet.

The Short-Range Committee wanted a more pronounceable name for the language than “CBL”. At a meeting in September 1969, the committee members proposed six names:

“BUSY” (BUsiness SYstem)

“BUSYL” (BUsiness SYstem Language)

“INFOSYL” (INFOrmation SYstem Language)

“DATASYL” (DATA SYstem Language)

“COSYL” (COmmon SYstem Language)

“COCOSYL” (COmmon COmputer SYstem Language)

The next day, a member of the committee suggested “COBOL” (COmmon Business-Oriented Language), and the rest of the committee agreed.

I wish they’d have kept the name “BUSY”, because it’s easier to pronounce and remember than “COBOL”. Today, COBOL programmers are still known as “BUSY bodies”.

From Sperry Rand’s FLOW-MATIC, the new language (called “COBOL”) borrowed two rules:

Begin each statement with an English verb.

Put data descriptions in a different program division than procedures.

From IBM’s COMMERCIAL TRANSLATOR, COBOL borrowed group items (01 and 02), PICTURE symbols, fancy IF statements, and COMPUTE formulas.

Compromises On some issues, the members of the committee couldn’t agree, so they compromised.

For example, some members wanted COBOL to let the programmers construct mathematical formulas by using these symbols:

+       -       *       /       =       (       )

But other members of the committee disagreed: they argued that since COBOL is supposed to be for stupid businessmen who fear formulas, COBOL ought to use the words ADD, SUBTRACT, MULTIPLY, and DIVIDE instead. The committee compromised: when you write a COBOL program, you can use the words ADD, SUBTRACT, MULTIPLY, and DIVIDE; if you prefer, you can use a formula instead, but you must warn the computer by putting the word COMPUTE in front of the formula.

Can COBOL handle long numbers? How long? The committee decided that COBOL would handle any number up to 18 digits long. The committee also decided that COBOL would handle any variable name up to 30 characters long. So the limits of COBOL are “18 and 30”.

Why did the committee pick those two numbers — “18 and 30” — instead of “16 and 32”? Answer: some manufacturers wanted “16 and 32” (because their computers were based on the numbers 16 and 32), but other manufacturers wanted other combinations (such as “24 and 36”); the committee, hunting for a compromise, chose “18 and 30”, because nobody wanted it, and so it would give no manufacturer an unfair advantage over competitors. In other words, COBOL was designed to be equally terrible for everybody! That’s politics!

COBOL’s popularity In 1960, the Defense Department announced it would buy just computers that understand COBOL, unless a manufacturer can demonstrate why COBOL isn’t helpful. In 1961, Westinghouse Electric Corp. made a similar announcement. Other companies followed. COBOL became the most popular computer language. Today it’s still the most popular computer language for maxicomputers, though programmers on minicomputers and microcomputers have switched to newer languages.

Improvements The original version of COBOL was finished in 1960 and called COBOL 60. Then came an improvement, called COBOL 61. The verb SORT and a “Report Writer” feature were added in 1962. Then came COBOL 65, COBOL 68, COBOL 74, and COBOL 85.

COBOL’s most obvious flaw To write a COBOL program, you must put info about file labeling into the data division’s FD command. Since file labeling describes the environment, not the data, COBOL should have been changed, to put the labeling in the environment division instead.

Jean Sammet, who headed some of the Short-Term Committee’s subcommittees, admits her group goofed when it decided to put labeling in the data division. But COBOL’s too old to change now.


The first version of BASIC was developed in 1963 and 1964 by a genius (John Kemeny) and his friend (Tom Kurtz).

How the genius grew up John Kemeny was a Jew born in Hungary in 1926. In 1940 he and his parents fled from the Nazis and came to America. Although he knew hardly any English when he began high school in New York, he learned enough so he graduated as the top student in the class. Four years later, he graduated from Princeton summa cum laude even though he had to spend 1½ of those years in the Army, where he helped solve equations for the atomic bomb.

Two years after his B.A., Princeton gave him a Ph.D. in mathematics and philosophy, because his thesis on symbolic logic combined both fields.

While working for the Ph.D., he was also Einstein’s youngest assistant. He told Einstein he wanted to quit math and instead hand out leaflets for world peace. Einstein replied: handing out leaflets would waste his talents; the best way for him to help world peace would be to become a famous mathematician, so people would listen to him, as they had to Einstein. He took Einstein’s advice and stayed with math.

After getting his Ph.D., he taught symbolic logic in Princeton’s philosophy department. In 1953, most of Dartmouth College’s math professors were retiring, so Dartmouth asked Kemeny to come to Dartmouth, chair the department, and “bring all your friends”. He accepted the offer and brought his friends. That’s how Dartmouth stole Princeton’s math department.

At Dartmouth, Kemeny invented several new branches of math. Then Kemeny’s department got General Electric to sell Dartmouth a computer at 90% discount, in return for which his department had to invent programs for it and let General Electric use them. To write the programs, Kemeny invented his own little computer language in 1963 and showed it to his colleague Thomas Kurtz, who knew less about philosophy but more about computers. Kurtz added features from ALGOL and FORTRAN and called the combination “BASIC”.

After inventing BASIC, Kemeny became bored and thought of quitting Dartmouth. Then Dartmouth asked him to become president of the college. He accepted.

Later, when the Three-Mile Island nuclear power plant almost exploded, President Jimmy Carter told Kemeny to head the investigation, because of Kemeny’s reputation for profound philosophical and scientific impartiality. Kemeny’s report was impartial — and sharply critical of the nuclear industry.

BASIC versus ALGOL & FORTRAN BASIC is simpler than both ALGOL and FORTRAN in two ways:

1. In ALGOL and FORTRAN, you must tell the computer which variables are integers and which are reals. In ALGOL, you do that by saying INTEGER or REAL. In FORTRAN, you do that by choosing an appropriate first letter for the variable’s name. In BASIC, the computer assumes all variables are real, unless you specifically say otherwise.

2. In ALGOL and FORTRAN, output is a hassle. In FORTRAN, you have to worry about FORMATs. In ALGOL, each computer handles output differently — and in most cases strangely. BASIC’s PRINT statement automatically invents a good format.

Is BASIC closer to ALGOL than to FORTRAN? On the one hand, BASIC uses the ALGOL words FOR, STEP, and THEN and the ALGOL symbol (or ^). On the other hand, BASIC, uses the FORTRAN words RETURN and DIMENSION (abbreviated DIM); and BASIC’s “FOR I = 1 TO 9 STEP 2” puts the step size at the end of the statement, like FORTRAN’s “DO 30 I = 1,9,2” and unlike ALGOL’s “FOR I:=1 STEP 2 UNTIL 9”.

BASIC versus JOSS BASIC is not the simplest computer language. JOSS, which was developed a year earlier by the RAND Corporation, is simpler to learn. But JOSS doesn’t have string variables and doesn’t name programs (you must give each program a number instead, and remember what the number was). Also, programs written in JOSS run more slowly and require more of the computer’s memory than if written in BASIC.

A few programmers still use JOSS and three of its variants, which are called AID, FOCAL, and MUMPS. They all run on computers built by DEC. AID is used by high-school kids on PDP-8 computers, FOCAL by scientists on PDP-10 computers, and MUMPS by doctors designing databases of patient records on PDP-11 computers. Though MUMPS does have string variables and other modern features, it’s gradually being replaced by newer database languages such as DBASE.

Six versions Kemeny and Kurtz finished the original version of BASIC in May 1964. It included just these statements:

PRINT, GO TO, IF...THEN, FOR...NEXT, DATA...READ, GOSUB...RETURN, DIM, LET (for commands such as LET X=3), REM (for REMarks and comments), DEF (to DEFine your own functions), and END

In that version, the only punctuation allowed in the PRINT statement was the comma. The 2nd version of BASIC (October 1964) added the semicolon.

The 3rd version (1966) added the words INPUT, RESTORE, and MAT. (The word MAT helps you manipulate a “MATrix”, which means an “array”. Today, most versions of BASIC omit the word MAT, because its definition consumes too much RAM.)

In all those versions, you could use variables. For example, you could say LET X=3. A variable was a letter that stood for a number. The 4th version (1967) added a new concept: string variables (such as A$). That version also added TAB (to improve the printing), RANDOMIZE (to improve RND), and ON...GO TO.

The 5th version (1970) added data files (sequential access and random access).

The 6th version (1971) added PRINT USING and a sophisticated way to handle subroutines — a way so sophisticated that most microcomputers don’t have it yet!

How BASIC became popular During the 1960’s and 1970’s, Kemeny & Kurtz worked on BASIC with a fervor that was almost religious.

They believed every college graduate should know how to program a computer, and be as literate in BASIC as in English.

They convinced Dartmouth to spend as much on its computer as on the college library. They put computer terminals in practically every college building (even in the dorms), and let all the kids who lived in the town come onto the campus and join the fun. Altogether, the campus had about 300 terminals. Over 90% of all Dartmouth students used BASIC before they graduated.

Dartmouth trained high-school teachers how to use BASIC. Soon many colleges, high schools, and prep schools throughout New England had terminals connected to Dartmouth’s computer by phone.

General Electric, which built Dartmouth’s computer, quit making computers and sold its computer factory to Honeywell. So now Dartmouth’s computer is called a “Honeywell”.

Since Dartmouth’s research on BASIC was partially funded by the National Science Foundation, BASIC was in the public domain. Other computer manufacturers could use it without having to worry about copyrights or patents.

DEC The first company to copy Dartmouth’s ideas was Digital Equipment Corporation (DEC).

DEC put BASIC and FOCAL on DEC’s first popular minicomputer, the PDP-8. When DEC saw that programmers preferred BASIC, DEC stopped developing FOCAL and devoted all its energies to improving BASIC further.

DEC invented fancier minicomputers (the PDP-11 and Vax) and maxicomputers (the Decsystem-10 and Decsystem-20) and put BASIC on all of them. DEC’s versions of BASIC were similar to Dartmouth’s. Though the versions put on the PDP-8 were quite primitive (almost as bad as Dartmouth’s first edition), the versions put on DEC’s fancier computers were more sophisticated. Eventually, DEC put decent versions of BASIC even on the PDP-8.

DEC’s best version of BASIC is VAX BASIC, which works just on VAX computers. DEC’s second-best version of BASIC is BASIC-PLUS-2, which works on the VAX, the PDP-11, and the Decsystem-20. DEC’s third-best version of BASIC is BASIC-PLUS, which works only on the PDP-11. DEC’s other versions of BASIC aren’t as fancy.

HP Soon after DEC started putting BASIC on its computers, Hewlett-Packard (HP) decided to do likewise.

HP put BASIC on the HP-2000 computer, and then put a better version of BASIC on the HP-300 computer.

Unfortunately, HP’s BASIC was more difficult to use than DEC’s. On Hewlett-Packard computers, each time you used a string you had to write a “DIM statement” that warned the computer how long the string would be: the DIM statement had to say how many characters the string would contain.

Other major manufacturers Most other manufacturers imitate the versions of BASIC invented by Dartmouth and DEC. Unfortunately, Data General, Wang, and IBM made the mistake of copying Hewlett-Packard instead.

That’s how BASIC developed on maxicomputers and minicomputers.

How Microsoft BASIC arose The first popular microcomputer was the Altair 8800, which used a version of BASIC invented by a 20-year-old kid named Bill Gates. His version imitated DEC’s.

The Altair computer was manufactured by a company called Mits. When Mits didn’t treat Bill Gates fairly, he broke away from Mits and formed his own company, called Microsoft.

Bill Gates and his company, Microsoft, invented many versions of BASIC.

The first was called 4K BASIC, because it consumed only 4K of memory chips (RAM or ROM). Then came 8K BASIC, which included a larger vocabulary. Then came Extended BASIC, which included an even larger vocabulary and consumed 14K. All those versions were intended for primitive microcomputers that used tapes instead of disks. Finally came Disk BASIC, which came on a disk and included all the commands for handling disks. His Disk BASIC version 4 was further improved, to form Disk BASIC version 5, which is the version of BASIC still used on CP/M computers and on the Radio Shack model 4. It’s also called MBASIC and BASIC-80.

All those versions of BASIC were written for computers that contained an 8080 or Z-80 CPU. Simultaneously, he wrote 6502 BASIC, for Apple 2 and Commodore computers.

The Apple 2 version of 6502 BASIC is called Applesoft BASIC.

Commodore’s version of 6502 BASIC is called Commodore BASIC.

Unfortunately, 6502 BASIC is rather primitive: it resembles his 8K BASIC. So if you’re trying to learn advanced BASIC programming, you should not get an Apple 2e or 2c or Commodore 64!

After writing 6502 BASIC, Bill wrote an improved version of it, called 6809 BASIC, available just for Radio Shack’s Color Computer. Radio Shack calls it Extended Color BASIC.

Texas Instruments (TI) asked Bill to write a version of BASIC for TI computers. Bill said “yes”. Then TI told Bill what kind of BASIC it wanted. Bill’s company — Microsoft — found 90 ways in which TI’s desires would contradict Microsoft’s traditions. Microsoft convinced TI to change its mind and remove 80 of those 90 contradictions, but TI stood firm on the other 10.

So TI BASIC (which is on the TI-990 and TI-99/4A computers) contradicts all other versions of Microsoft BASIC in 10 ways. For example, in TI BASIC, the INPUT statement uses a colon instead of a semicolon, and a multi-statement line uses a double colon (::) instead of a single colon.

Because of those differences, TI’s computers became unpopular, and TI stopped making them. Moral: if you contradict Bill, you’ll die!

Bill later invented an amazingly wonderful version of BASIC, better than all the other versions that had been invented. He called it GW BASIC (which stands for “Gee-Whiz BASIC”). It runs only on the IBM PC and clones.

When you buy PC-DOS from IBM, you typically get GW BASIC at no extra charge. (IBM calls it BASICA.) When you buy MS-DOS for an IBM clone, the typical dealer includes GW BASIC at no extra charge, but ask!

Beyond GW BASIC GW BASIC was the last version of BASIC that Bill developed personally. All further improvements & variants were done by his assistants at Microsoft.

Microsoft’s newest variations are Microsoft BASIC for the Mac, Amiga Microsoft BASIC (for the Commodore’s Amiga computer), Quick BASIC (for the IBM PC and clones), QBASIC (which you get instead of GWBASIC when you buy MS-DOS version 5 or 6), and Visual BASIC (which lets you easily create Windows-style programs that let the human use a mouse and pull-down menus). Those BASICs are slightly harder to learn how to use than GW BASIC; but once you understand them, you’ll prefer them because they run faster and include a better editor, more words from ALGOL and PASCAL, and fancier output.

While developing those versions of BASIC, Microsoft added three new commands that are particularly exciting: SAY, END IF, and SUB.

The SAY command makes the computer talk, by using a voice synthesizer. for example, to make the computer’s voice say “I love you”, type this command:


That makes the computer translate “I love you” into phonetics and then say the phonetics. That command works on the Amiga, and I hope Microsoft will put it on other computers also.

The END IF and SUB commands give BASIC some of PASCAL’s power. By using the END IF command, you can make the IF statement include many lines, like this:






By using the SUB command, you can give a subroutine a name.

Borland Microsoft’s main competitor for languages is Borland, which made Turbo PASCAL, Turbo C, and
Turbo BASIC.

Turbo BASIC version 1.1 runs faster than Quick BASIC, is easier to understand, and includes almost as many commands. But Borland’s stopped marketing Turbo BASIC, so Borland can devote its energies to other Borland products that are more profitable.

Divergences GW BASIC, Microsoft BASIC for the Macintosh, Amiga Microsoft BASIC, Quick BASIC, and Turbo BASIC are all wonderful.

Over the years, several microcomputer manufacturers tried to invent their own versions of BASIC, to avoid paying royalties to Bill Gates. They were sorry!

For example, Radio Shack tried hiring somebody else to write Radio Shack’s BASIC. That person quit in the middle of the job; Radio Shack’s original BASIC was never completed. Nicknamed “Level 1 BASIC”, it was a half-done mess. Radio Shack, like an obedient puppy dog, then went to Bill, who finally wrote a decent version of BASIC for Radio Shack; Bill’s version was called “Level 2”. Today, Radio Shack uses further improvements on Bill’s Level 2 BASIC.

Apple’s original attempt at BASIC was called “Apple Integer BASIC”. It was written by Steve Wozniak and was terrible: it couldn’t handle decimals, and it made the mistake of imitating Hewlett-Packard instead of DEC (because Steve had worked at Hewlett-Packard). Eventually, Steve wised up and hired Bill, who wrote Apple’s better BASIC, called Applesoft (which means “Apple BASIC by Microsoft”). Applesoft was intended for tapes, not disks. Later, when Steve Wozniak wanted to add disks to the Apple computer, he made the mistake of not rehiring Bill — which is why Apple’s disk system is worse than Radio Shack’s.

At Atari, an executive who didn’t want to hire Bill made the mistake of hiring the inventor of Apple’s disastrous DOS. That guy’s BASIC, which is called Atari BASIC, resembles Hewlett-Packard’s BASIC. Like Apple’s DOS, it looks pleasant at first glance but turns into a nightmare when you try to do any advanced programming. As a result, Atari’s computers didn’t become as popular as Atari hoped, and the executive who “didn’t want to hire Bill” was fired. Atari finally hired Bill’s company, which wrote Atari Microsoft BASIC version 2.

Two other microcomputer manufacturers — North Star Computers and APF — tried developing their own versions of BASIC, to avoid paying royalties to Bill. Since their versions of BASIC were lousy, they went out of business.

While DEC, Hewlett-Packard, Microsoft, and other companies were developing their own versions of BASIC, professors back at Dartmouth College were still tinkering with Dartmouth BASIC version 6. In 1976, Professor Steve Garland added more commands from ALGOL, PL/I, and PASCAL to Dartmouth BASIC. He called his version “Structured BASIC” or SBASIC.

One of BASIC’s inventors, Professor Tom Kurtz, became chairman of an ANSI committee to standardize BASIC. His committee published two reports.

The 1977 report defined ANSI Standard Minimal BASIC, a minimal standard that all advertised versions of “BASIC” should live up to. That report was quite reasonable, and everybody agreed to abide by it. (Microsoft’s old versions of BASIC were written before that report came out. Microsoft Disk BASIC version 5 was Microsoft’s first version to obey that standard.)

In 1985, ANSI created a more ambitious report, to standardize the most advanced aspects of BASIC.

The report said that the advanced aspects of BASIC should closely follow SBASIC and the other versions developed at Dartmouth. But Bill Gates, who invented Microsoft BASIC and was also one of the members of the committee, disliked some aspects of Dartmouth’s BASIC and quit the committee. (He was particularly annoyed by the committee’s desire to include Dartmouth’s MAT commands, which consume lots of RAM and which hardly anybody uses.) He refused to follow the committee’s recommendations.

That left two standards for advanced BASIC: the “official” standard, defined by the ANSI committee; and the “de facto” standard, which is Bill Gates’ GW BASIC, the version of BASIC that most people use.

The two standards are quite different from each other. For example, in GW BASIC you say:


In ANSI BASIC, you say this instead:


Notice that in ANSI BASIC, you must insert the word PROMPT after INPUT, insert a questions mark and blank space before the second quotation mark, and type a colon instead of a semicolon.

Tom Kurtz (who chaired the ANSI committee) and John Kemeny (who invented BASIC with Tom Kurtz) put ANSI BASIC onto Dartmouth’s computer. So ANSI BASIC became Dartmouth’s seventh official version of BASIC.

Then Kurtz and Kemeny left Dartmouth and formed their own company, which invented True BASIC. It’s a version of ANSI BASIC that runs on the IBM PC and the Apple Macintosh.

In some ways, True BASIC is slightly better than Microsoft’s GW BASIC and Quick BASIC. In other ways, True BASIC is slightly worse. Since Microsoft’s BASIC versions have become the de facto standard, and since True BASIC isn’t significantly better, hardly anybody is switching from Microsoft BASIC to True BASIC.

Comparison chart This chart compares the most popular versions of BASIC for microcomputers:


                                                        │ Video │ Audio │ Logic │


                                                        │       │       │       │

                                                        │       │       │       │

                                                        │       │       │       │


│IBM PC with QBASIC (or Visual BASIC, ver. 2 or later)  │ √ √ √ │ √ √   │ √ √ √ │

│Commodore Amiga with Microsoft BASIC                   │ √ √ √ │ √   √ │ √ √ √ │


│Apple Macintosh with Quick BASIC                       │ √ √ √ │ √     │ √ √ √ │


│IBM PC (with GW BASIC), Commodore 128, or TRS-80 Color │ √ √ √ │ √ √   │ √     │


│Atari ST                                               │ √ √ √ │ √     │ √     │


│Atari XE (or XL) with Microsoft BASIC                  │ √ √   │ √     │ √     │


│TRS-80 Model 3, 4, 4P, or 4D                           │ √     │       │ √     │


│Apple 2, 2+, 2e, 2c, 2c+, or 2GS                       │   √   │       │       │


│Commodore 64 or Vic-20                                 │       │       │       │


It shows which versions of BASIC understand these 9 words: USING, LINE, CIRCLE, SOUND, PLAY, SAY, ELSE, END IF, and SUB.

The versions of BASIC at the top of the chart (QBASIC, Visual BASIC, and Amiga BASIC) are the best: they understand 8 of the 9 words. The versions of BASIC at the bottom of the chart (Commodore 64 BASIC and Vic-20 BASIC) are the worst: they understand none of the words.

Here’s what those 9 words accomplish:

The word “USING” lets you control how many digits the computer will print after the decimal point.

“LINE” makes the computer draw a diagonal line across the screen.

“CIRCLE” makes the computer draw a circle as big as you wish.

“SOUND” and “PLAY” make the computer create music.

“SAY” makes the computer talk.

“ELSE” and “END IF” let you create fancy IF statements.

“SUB” lets you name subroutines.

Although the Commodore 128 and Radio Shack TRS-80 Color Computer were cheap, the chart shows their versions of BASIC are better than the Apple 2c’s, which cost more. If schools would have bought Commodore 128 and Radio Shack TRS-80 Color Computers instead of Apple 2c’s, students would have become better programmers!


During the early 1960’s, IBM sold two kinds of computers. One kind was for use by scientists; the other kind was for use by business bookkeepers. For the scientific kind of computer, the most popular language was FORTRAN. For the business kind of computer, the most popular language was COBOL.

In 1962, IBM secretly began working on a project to create a single, large computer that could be used by everybody: scientists and businesses. IBM called it the IBM 360, because it could handle the full circle of applications. What language should the IBM 360 be programmed in? IBM decided to invent a single language that could be used for both science and business.

IBM’s first attempt at such a language was “FORTRAN V”. It ran all the FORTRAN IV programs but also included commands for handling strings and fields in data files. But IBM never announced FORTRAN V to the public; instead, in 1963 IBM began working on a dramatically more powerful language called “FORTRAN VI”, which would resemble FORTRAN but be much more powerful and modern (and hence incompatible). It would also include all the important features of COBOL and ALGOL.

As work on FORTRAN VI progressed, IBM realized it would be so different from traditional FORTRAN that it should have a different name. In 1964, IBM changed the name to “NPL” (New Programming Language), since the language was intended to go with the IBM 360 and the rest of IBM’s New Product Line.

When IBM discovered that the letters “NPL” already stood for the National Physics Laboratory in England, IBM changed the language’s name to Programming Language One (PL/I), to brag it was the first good programming language and all its predecessors were worth zero by comparison.

Troublesome timing The committee that invented PL/I had a hard time.

The committee consisted of just 6 official members (3 from IBM and 3 from a FORTRAN user group). A few friends of the committee attended also. The committee could meet only on weekends, and only in hotel rooms in New York State and California. The first meeting was in October 1963 (at the Motel-on-the-Mountain on the New York Thruway), and IBM insisted that the entire language design be finished by December. It was a rush job!

The committee didn’t meet the deadline. It finished 2 months late, in February.

After the design was finished, the language still had to be put onto the computer. Since that took 2½ more years of programming and polishing, the language wasn’t available for sale to IBM’s customers until August 1966.

That was too late. It was after IBM had already begun shipping the IBM 360. The 360’s customers continued using FORTRAN and COBOL, since PL/I wasn’t available initially. After those customers bought, installed, and learned how to use FORTRAN and COBOL on the 360, they weren’t willing to switch to PL/I. Switching was too much trouble.

Other troubles PL/I was expensive to run. It required twice as much RAM as COBOL, four times as much RAM as FORTRAN. It ran slowly: it took 1½ times as long to compile as COBOL, twice as long as FORTRAN.

Another obstacle to PL/I’s acceptance was lethargy: most programmers already knew FORTRAN and COBOL, were satisfied with those languages, and weren’t willing to spend the time to learn something new.

Some programmers praise PL/I for being amazingly powerful. Others call it just a scheme by IBM to get people to buy more RAM. Others call it a disorganized mess, an “ugly kitchen sink of a language”, thrown together by a committee that was in too much of a rush.

Since PL/I is such a large language, hardly anybody understands it all. As a typical harried PL/I programmer, you study just the part of the language you intend to use. But if you make a mistake, the computer might not gripe: instead, it might think you’re trying to give a different PL/I command from a different part of the language that you never studied. So instead of griping, the computer will perform an instruction that wasn’t what you meant.

Universities Universities debated which language to teach freshman. For a while, the choice was between FORTRAN (the “standard”), ALGOL (the “pure and simple”), and PL/I (the “powerful”).

In 1972, Cornell University developed a stripped-down version of PL/I for students. That version, called PL/C, is a compromise between PL/I’s power and ALGOL’s pure simplicity.

In 1975, The University of Toronto developed an even more stripped-down version of PL/I, and called it SP/k. Although it allows fewer statements than PL/C, it runs faster and prints messages that are even more helpful. SP/k comes in several sizes: the tiniest is SP/1; the largest is SP/8.

Stripped-down versions of PL/I remained popular in universities until about 1980, when they began to be replaced by PASCAL.

Microcomputers Digital Research invented a tiny version of PL/I for microcomputers, and called it PL/M. Unfortunately, PL/M can’t handle decimals. PL/M was popular during the late 1970’s and early 1980’s, but most PL/M programmers eventually switched to C.

Maxicomputers PL/I is still used on large IBM computers, because it’s the only language that includes enough commands to let programmers unleash IBM’s full power.

Statements PL/I uses many statements for input and output. The statement’s meaning depends mainly on the statement’s first word:

First word What the computer will do

GET       input from a terminal or simple file

PUT       print on a terminal or simple file

OPEN        start using a file

CLOSE     stop using a file

READ        input from a file whose picture is unedited

WRITE     print on a file whose picture is unedited

DELETE    delete an item from a file

REWRITE      replace an item in a file

LOCATE    print a "based" variable onto a file

UNLOCK    let other programs use the file

FORMAT    use a certain form for spacing the input and output

DISPLAY    chat with operator who sits at computer’s main terminal

These statements interrupt:

First word What the computer will do

STOP      stop the program

EXIT      stop a task (in a program that involves several tasks)

HALT        interrupt the program; free the terminal to do other tasks

DELAY     pause for a certain number of milliseconds

WAIT      pause until other simultaneous routines finish their tasks

These statements handle conditions:

First word What the computer will do

IF        if a certain condition occurs now, do certain statements

ON        if a certain condition occurs later, do certain statements

SIGNAL    pretend a condition such as OVERFLOW occurs

REVERT    cancel the ON statements

These statements handle variables:

First word What the computer will do

DECLARE      make some variables be integers, other be reals, etc.

DEFAULT      assume all variables are integers, or a similar assumption

ALLOCATE    create a temporary variable

FREE      destroy a temporary variable and use its RAM otherwise

These statements handle general logic:

First word What the computer will do

GO        go to a different line

CALL        go to a subroutine

RETURN    return from a subroutine to the main routine

ENTRY     skip the subroutine’s previous lines; begin here instead

PROCEDURE  begin a program or subprogram

DO        begin a loop or compound statement

BEGIN     begin a block of statements

END       end program, subprogram., loop, compound statement, or block

Half of those statements are borrowed from FORTRAN, ALGOL, and COBOL.




Like ALGOL, PL/I requires a semicolon at the end of each statement. Besides the statements listed above, you can also give an assignment statement (such as “N=5;”), a null statement (which consists of just a semicolon), and a preprocessor statement (which tells the computer how to create its own program).


In 1968, a European committee tried to invent an improved version of ALGOL. The majority of the committee agreed on a version called “ALGOL 68”. It was strange: it even required you to spell some commands backwards.

A few members of the committee were dissidents who disagreed with the majority and thought ALGOL 68 was nuts. One of the dissidents, Niklaus Wirth, quit the committee and created his own version of ALGOL. He called his version PASCAL. Today, most computerists feel he was right and the majority of the committee was wrong, PASCAL is better than ALGOL 68.

He wrote PASCAL in Switzerland, for a CDC maxicomputer that used punched cards. His version of PASCAL couldn’t handle video screens, couldn’t handle random-access data files, and couldn’t handle strings well. Those three limitations were corrected in later versions of PASCAL — especially the version invented at the University of California at San Diego (UCSD), which even includes LOGO-style commands that move a turtle.

Apple’s PASCAL Apple Computer Company got permission to sell an Apple version of UCSD PASCAL. Apple ran full-page advertisements, bragging that the Apple 2 was the only popular microcomputer that could handle PASCAL.

For $495, Apple Computer Company sold the “Apple Language System”, which included 4 disks containing PASCAL, 2 disks containing souped-up BASIC, and a card containing 16K of extra RAM. Many people spent the $495 for PASCAL but were disappointed. They expected that by spending $495, they’d be able to write programs more easily, but they discovered that PASCAL is harder to learn than BASIC.

PASCAL is helpful only if the program you’re writing is long. PASCAL helps you organize and dissect long programs more easily than BASIC. But the average Apple owner never writes long programs and never needs PASCAL.

Many customers felt “ripped off”, since they had spent $495 and received no benefit in return. But maybe that’s what “marketing” is all about.

PASCAL’s popularity Many programmers who’d been writing big FORTRAN programs for big computers switched to PASCAL, because PASCAL helps organize large programs better, and because FORTRAN is archaic. Many programmers who’d been using PL/I switched to PASCAL, because PASCAL consumes less RAM than PL/I and fits in smaller computers.

PASCAL became popular. Many colleges required freshman computer-science majors to take PASCAL. The College Entrance Examination Board’s Advanced Placement Test in Computer Science required knowing PASCAL. Many high-school students studied PASCAL to pass that test and prepare for college.

But recently, BASIC has improved (by incorporating many features from PASCAL), so PASCAL no longer has much advantage over BASIC. Now students skip PASCAL: after learning BASIC, they skip past PASCAL to tougher languages: JAVA and C++. Now the Advanced Placement Test in Computer Science requires knowing JAVA. PASCAL is ignored.


After Niklaus Wirth invented PASCAL, he began designing a more ambitious language, called MODULA.

He designed the first version of MODULA in 1975. In 1979 he designed an improvement called MODULA-2. When today’s programmers discuss “MODULA”, they mean MODULA-2.

MODULA-2 is very similar to PASCAL. Like PASCAL, MODULA-2 requires each program’s main routing to begin with the word BEGIN; but MODULA-2 does not require you to say BEGIN after DO WHILE or IF THEN:

PASCAL                                                              MODULA-2

IF AGE<18 THEN                    IF AGE<18 THEN

   BEGIN                             WRITESTRING("YOU ARE STILL A MINOR");



   END                               WRITESTRING("GLAD YOU ARE AN ADULT");

ELSE                                WRITESTRING("WE CAN HAVE ADULT FUN")

   BEGIN                          END;




That example shows four ways that MODULA-2 differs from PASCAL: MODULA-2 says WRITESTRING instead of WRITELN, uses regular quotation marks (") instead of apostrophes, lets you omit the word BEGIN after IF ELSE (and WHILE DO), and lets you omit the word END before ELSE.

Advanced programmers like MODULA-2 better than PASCAL because MODULA-2 includes extra commands for handling subroutines.


Many programmers use C.

How C arose In 1963 at England’s Cambridge University and the University of London, researchers developed a “practical” version of ALGOL and called it the Combined Programming Language (CPL). In 1967 at Cambridge University, Martin Richards invented a simpler, stripped-down version of CPL and called it Basic CPL (BCPL). In 1970 at Bell Labs, Ken Thompson developed a version that was even more stripped-down and simpler; since it included just the most critical part of BCPL, he called it B.

Ken had stripped down the language too much. It no longer contained enough commands to do practical programming. In 1971, his colleague Dennis Ritchie added a few commands to B, to form a more extensive language, which he called New B. Then he added even more commands and called the result C, because it came after B. Most of C was invented in 1972. In 1973, it was improved enough so that it was used for something practical: developing a new version of the Unix operating system. (Unix was invented at Bell Labs. The original version of Unix was created by using B. Beginning in 1973, Unix versions were created by using C.)

So C is a souped-up version of New B, which is a souped-up version of B, which is a stripped-down version of BCPL, which is a stripped-down version of CPL, which is a “practical” version of ALGOL.

C’s peculiarities Like B, C is a tiny language.

C doesn’t even include any words for input or output. When you buy C, you also get a library of routines that can be added to C. The library includes words for output (such as printf), input (such as scanf), math functions (such as sqrt), and other goodies. When you write a program in C, you can choose whichever parts of the library you need: the other parts of the library don’t bother to stay in RAM. So if your program uses just a few of the library’s functions, running it will consume very little RAM. It will consume less RAM than if the program were written in BASIC or PASCAL.

In BASIC, if you reserve 20 RAM locations for X (by saying DIM X(20)) and then say X(21)=3.7, the computer will gripe, because you haven’t reserved a RAM location of X(21). If you use C instead, the computer will not gripe about that kind of error; instead, the computer will store the number 3.7 in the RAM location immediately after X(20), even if that location’s already being used by another variable, such as Y. As a result, Y will get messed up. Moral: C programs run quickly and dangerously, because in C the computer never bothers to check your program’s reasonableness.

In your program, which variables are integers, and which are real?

BASIC assumes all variables are real. FORTRAN and PL/I assume all variables beginning with I, J, K, L, M, and N are integers and the rest are real. ALGOL and PASCAL make no assumptions at all; they require you to write a declaration saying “integer” or “real” for each variable. C, by contrast, assumes all variables are integers, unless you specifically say otherwise.


In 1975, the U.S. Department of Defense decided it wanted a new kind of computer language, so the Department wrote a list of requirements the language would have to meet.

The original list of requirements was called the Strawman Requirements (1975). Then came improved versions, called Woodenman (1975), Tinman (1976), Ironman (1978), and finally Steelman (1979).

While the Department was moving from Strawman to Steelman, it also checked whether any existing computer language could meet such requirements. The Department concluded that no existing computer language came even close to meeting the requirements, and so a new language would indeed have to be invented. The Department also concluded that the new language would have to resemble PASCAL, ALGOL 68, or PL/I, but be better.

Contest In 1977, the Department held a contest, to see which software company could invent a language meeting such specifications (which were in the process of changing from Tinman to Ironman).

16 companies entered the contest.

The Department selected 4 semifinalists and paid them to continue their research for six more months. The semifinalists were CII-Honeywell-Bull (which is French and owned partly by Honeywell), Intermetrics (in Cambridge, Massachusetts), SRI International, and Softech.

In 1978, the semifinalists submitted improved designs, which were all souped-up versions of PASCAL (instead of ALGOL 68 or PL/I). To make the contest fair and prevent bribery, the judges weren’t told which design belonged to which company. The 4 designs were called “Green”, “Red”, “Yellow”, and “Blue”.

Yellow and Blue lost. The winning designs were Green (designed by CII-Honeywell-Bull) and Red (designed by Intermetrics).

The Department paid the two winning companies to continue their research for one more year. In 1979, the winning companies submitted their improved versions.

The winner was the Green language, designed by CII-Honeywell-Bull.

The Department decided that the Green language would be called ADA to honor Ada Lovelace, the woman who was the world’s first programmer.

So ADA is a PASCAL-like language developed by a French company (CII-Honeywell-Bull) under contract to the U.S. Department of Defense.

ADA is too big to be practical. Researchers made computers understand part of ADA but had difficulty making computers understand the whole language.


DBASE was invented by Wayne Ratliff because he wanted to bet on which football teams would win the 1978 season. To bet wisely, he had to know how each team had scored in previous games, so every Monday he clipped pages of football scores from newspapers. Soon his whole room was covered with newspaper clippings. To reduce the clutter, he decided to write a data-management program to keep track of all the statistics.

He worked at the Jet Propulsion Laboratory (JPL). His coworkers had invented a data-management system called the JPL Display and Information System (JPLDIS), which imitated IBM’s RETRIEVE.

Unfortunately, RETRIEVE and JPLDIS both required maxicomputers. Working at home, he invented VULCAN, a stripped-down version of JPLDIS that was small enough to run on the CP/M microcomputer in his house. It was even good enough to let him compile football statistics — though by then he’d lost interest in football and was more interested in the theory of data management and business applications.

In 1979, he advertised his VULCAN data-management system in Byte Magazine. The mailman delivered so many orders to his house that he didn’t have time to fill them all — especially since he still had a full-time job at JPL. He stopped advertising, to give himself a chance to catch up on filling the orders.

In 1980, the owners of Discount Software phoned him, visited his home, examined VULCAN, and offered to market it for him. He agreed.

Since “Discount Software” was the wrong name to market VULCAN under, Discount Software’s owners — Hal Lashlee and George Tate — thought of marketing VULCAN under the name “Lashlee-Tate Software”. But since the “Lashlee” part sounded too wimpy, they changed the name to Ashton-Tate Software.

Instead of selling the original version of VULCAN, Ashton-Tate Software decided to sell Wayne’s further improvement, called DBASE 2. It ran faster, looked prettier on the screen, and was easier to use.

At Ashton-Tate, George Tate did most of the managing. Hal Lashlee was a silent partner who just contributed capital.

Ad George Tate hired Hal Pawluck to write an ad for DBASE 2. Hal’s ad was ingenious. It showed a photograph of a bilge pump (the kind of pump that removes water from a ship’s bilge). The ad’s headline said: “DBASE versus the Bilge Pump”. The ad went on to say that most database systems are like bilge pumps: they suck!

That explicit ad appeared in Infoworld, which was a popular, concise weekly newspaper read by all computer experts. Suddenly, all experts knew that DBASE was the database-management system that claimed not to suck.

The ad generated just one serious complaint — from the company that manufactured the bilge pump!

George Tate offered to add a footnote, saying “This bilge pump does not suck”. The pump manufacturer didn’t like that either but stopped complaining.

Beyond DBASE 2 The original DBASE 2 ran on computers using the CP/M operating system. It worked well. When IBM began selling the IBM PC, Wayne invented an IBM PC version of DBASE 2, but it was buggy.

He created those early versions of DBASE by using assembly language. By using C instead, he finally created an IBM PC version that worked reliably and included extra commands. He called it DBASE 3.

DBASE 2 and DBASE 3 were sold as programming languages, but many people who wanted to use databases didn’t want to learn programming and didn’t want to hire a programmer. So Ashton-Tate created a new version, called DBASE 3 PLUS, which you can control by using menus instead of typing programming commands; but those menus are hard to learn how to use and incomplete: they don’t let you tap DBASE 3 PLUS’s full power, which requires that you learn programming.

In 1988, Ashton-Tate began shipping DBASE 4, which includes extra programming commands.

Some of DBASE 4’s commands were copied from a database language called Structured Query Language (SQL), which IBM invented for mainframes. DBASE 4 also boasted better menus than DBASE 3 PLUS. Unfortunately, Ashton-Tate priced DBASE 4 high: $795 for the plain version, $1295 for the “developer’s” version.

Over the years, Ashton-Tate became a stodgy bureaucracy. George Tate died, Wayne Ratliff quit, the company’s list price for DBASE grew ridiculously high, and the company was callous to DBASE users.

In 1991, Borland bought Ashton-Tate. In 1994, Borland began selling DBASE 5, then further improvements. In 1999, Borland gave up trying to sell DBASE; Borland transferred all DBASE rights to KSoft, which sells Visual DBASE 7.5 and is trying to develop DBASE 2000 (DB2K).

Dramatic improvements to DBASE have been created by other companies, who make clones of DBASE that outshine DBASE itself! The most popular clone is Visual FOXPRO 6, which runs faster than DBASE, includes extra commands, and is marketed by Microsoft.


EASY is a language I developed several years ago. It combines the best features of all other languages. It’s easy to learn, because it uses just these 12 keywords:





Here’s how to use them.…

SAY EASY uses the word SAY instead of BASIC’s word PRINT, because SAY is briefer. If you want the computer to say the answer to 2+2, give this command:

SAY 2+2

The computer will say the answer:


Whenever the computer prints, it automatically prints a blank space afterwards but does not press the ENTER key. So if you run this program —



the computer will say:


Here’s a fancier example:

SAY "LOVE" AS 3 AT 20 15 TRIM !

The “AS 3” is a format: it makes the computer print just the first 3 letters of LOVE. The “AT 20 15” makes the computer begin printing LOVE at the screen’s pixel whose X coordinate is 20 and whose Y coordinate is 15. The computer usually prints a blank space after everything, but the word TRIM suppresses that blank space. The exclamation point makes the computer press the ENTER key afterwards.

Here’s another example:


It means that henceforth, whenever you give a SAY command, the computer will print the answer simultaneously onto your screen, onto your printer, and onto a disk file named HARRY. If you ever want to cancel that “SAY TO” command, give a “SAY TO” command that contradicts it.

GET EASY uses the word GET instead of BASIC’s word INPUT, because GET is briefer. The command GET X makes the computer wait for you to input the value of X. Above the GET command, you typically put a SAY command that makes the computer ask a question.

You can make the GET command fancy, like this:

GET X AS 3 AT 20 15 WAIT 5

The “AS 3” tells the computer that X will be just 3 characters; the computer waits for you to type just 3 characters and doesn’t require you to press the ENTER key afterwards. The “AT 20 15” makes the computer move to pixel 20 15 before your typing begins, so your input appears at that part of the screen. The “WAIT 5” makes the computer wait just 5 seconds for your response. If you reply within 5 seconds, the computer sets TIME equal to how many seconds you took. If you do not reply within the 5 seconds, the computer sets TIME equal to -1.

LET The LET statement resembles BASIC’s. For example, you can say:


To let R be a random decimal, type:


To let R be a random integer from 1 to 6, type:


To let R be a random integer from -3 to 5, type:


REPEAT If you put the word REPEAT at the bottom of your program, the computer will repeat the entire program again and again, forming an infinite loop.

SKIP If you put the word SKIP in the middle of your program, the computer will skip the bottom part of the program. SKIP is like BASIC’s END or STOP.

HERE In the middle of your program, you can say:


An earlier line can say SKIP TO FRED. A later line can say REPEAT FROM FRED. The SKIP TO and REPEAT FROM are like BASIC’s GO TO.

IF In your program, a line can say:

IF X<3

Underneath that line, you must put some indented lines, which the computer will do if X<3.

Suppose you give a student a test on which the score can be between 0 and 100. If the student’s score is 100, let’s make the computer say “PERFECT”; if the score is below 100 but at least 70, let’s make the computer say the score and also say “OKAY THOUGH NOT PERFECT”; if the score is below 70, let’s make the computer say “YOU FAILED”. Here’s how:








To shorten the program, use the words NOT and BUT:








The phrase “IF NOT” is like BASIC’s ELSE. The phrase “IF NOT BUT” is like BASIC’s ELSE IF.

PICK You can shorten that example even further, by telling the computer to pick just the first IF that’s true:


  IF 100


  IF >=70





LOOP If you put the word LOOP above indented lines, the computer will do those lines repeatedly. For example, this program makes the computer say the words CAT and DOG repeatedly:




This program makes the computer say 5, 8, 11, 14, and 17:



That LOOP statement is like BASIC’s “FOR I = 5 TO 17 STEP 3”. If you omit the “BY 3”, the computer will assume “BY 1”. If you omit the “FROM 5”, the computer will assume “FROM 1”. If you omit the “TO 17”, the computer will assume “to infinity”.

To make the computer count down instead of up, insert the word DOWN, like this:


PREPARE To do an unusual activity, you should PREPARE the computer for it. For example, if you want to use subscripted variables such as X(100), you should tell the computer:


In that example, PREPARE is like BASIC’s DIM.

DATA EASY’s DATA statement resembles BASIC’s. But instead of saying READ X, say:


HOW In EASY, you can give any command you wish, such as:


If you give that command, you must also give an explanation that begins with the words:


Interrelated features In the middle of a loop, you can abort the loop. To skip out of the loop (and progress to the rest of the program), say SKIP LOOP. To hop back to the beginning of the loop (to do the next iteration of loop), say REPEAT LOOP.

Similarly, you can say SKIP IF (which makes the computer skip out of an IF) and REPEAT IF (which makes the computer repeat the IF statement, and thereby imitate PASCAL’s WHILE).

Apostrophe Like BASIC, EASY uses an apostrophe to begin a comment. The computer ignores everything to the right of an apostrophe, unless the apostrophe is between quotation marks or in a DATA statement.

Comma If two statements begin with the same word, you can combine them into a single statement, by using a comma.

For example, instead of saying —



you can say:

LET X=4, Y=7

Instead of saying —



you can say:


More info I stopped working on EASY in 1982 but expect to continue development again. To get on my mailing list of people who want details and updated info about EASY, phone me at 603-666-6644 or send me a postcard.


Most C programmers have switched to an improved C, called C++.


Java is a variant of C++ that runs slower but can be easier to learn.

While you’re using the Internet’s World Wide Web, you often see ads that are animated cartoons. Those ads are created by using Java. That’s Java’s main purpose: to create ads that are annoyingly eye-catching.


JavaScript is easier to learn than Java but lacks advanced commands.



Let’s examine the radical languages, beginning with the oldest radical — the oldest hippie — LISP.


LISP is the only language made specifically to handle lists of concepts. It’s the most popular language for research into artificial intelligence.

It’s the father of LOGO, which is “oversimplified LISP” and the most popular language for young children. It inspired PROLOG, which is a LISP-like language that lets you make the computer imitate a wise expert and become an expert system.

Beginners in artificial intelligence love to play with LOGO and PROLOG, which are easier and more fun than LISP. But most professionals continue to use LISP because it’s more powerful than its children.

The original version of LISP was called LISP 1. Then came an improvement, called LISP 1.5 (because it wasn’t different enough from LISP 1 to rate the title “LISP 2”). Then came a slight improvement on LISP 1.5, called LISP 1.6. The newest version of LISP is called Common LISP; it runs on maxicomputers, minicomputers, and microcomputers.

I’ll explain “typical” LISP, which is halfway between LISP 1.6 and Common LISP.

Typical LISP uses these symbols:


5+2    (PLUS 5 2)

5-2    (DIFFERENCE 5 2)

5*2    (TIMES 5 2)

5/2    (QUOTIENT 5 2)

5^2    (EXPT 5 2)

"LOVE" 'LOVE old versions say (QUOTE LOVE)

If you want the computer to add 5 and 2, just type:

(PLUS 5 2)

When you press the ENTER key at the end of that line, the computer will print the answer. (You do not have to say PRINT or any other special word.) The computer will print:


If you type —

(PLUS 1 3 1 1)

the computer will add 1, 3, 1, and 1 and print:


If you type —


the computer will find the difference between 7 and 2*3 and print:


If you type —


the computer will print:


Note you must type an apostrophe before LOVE but must not type an apostrophe afterwards. The apostrophe is called a single quotation mark (or a quote).

You can put a quote in front of a word (such as ‘LOVE) or in front of a parenthesized list of words, such as:


That makes the computer print:


LISP 1, LISP 1.5, and LISP 1.6 don’t understand the apostrophe. On those old versions of LISP, say (QUOTE LOVE) instead of ‘LOVE, and say (QUOTE (LAUGH LOUDLY)) instead of ‘(LAUGH LOUDLY).

The theory of lists LISP can handle lists. Each list must begin and end with a parenthesis.

Here’s a list of numbers: (5 7 4 2). Here’s a list of words: (LOVE HATE WAR PEACE DEATH).

Here’s a list of numbers and words: (2 WOMEN KISS 7 MEN). That list has five items: 2, WOMEN, KISS, 7, and MEN.

Here’s a list of four items: (HARRY LEMON (TICKLE MY TUBA TOMORROW AT TEN) RUSSIA). The first item is HARRY; the second is LEMON; the third is a list; the fourth is RUSSIA.

In a list, the first item is called the CAR, and the remainder of the list is called the CDR (pronounced “could er” or “cudder” or “coo der”). For example, the CAR of (SAILORS DRINK WHISKEY) is SAILORS, and the CDR is (DRINK WHISKEY).

To make the computer find the CAR of (SAILORS DRINK WHISKEY), type this:


The computer will print:


If you type —


the computer will print:


If you type —


the computer will find the CAR of the CDR of (SAILORS DRINK WHISKEY). Since the CDR of (SAILORS DRINK WHISKEY) is (DRINK WHISKEY), whose CAR is DRINK, the computer will print:


You can insert an extra item at the beginning of a list, to form a longer list. For example, you can insert MANY at the beginning of (SAILORS DRINK WHISKEY), to form (MANY SAILORS DRINK WHISKEY). To do that, tell the computer to CONStruct the longer list, by typing:


The computer will print:


Notice that CONS is the opposite of CAR and CDR. The CONS combines MANY with (SAILORS DRINK WHISKEY) to form (MANY SAILORS DRINK WHISKEY). The CAR and CDR break down (MANY SAILORS DRINK WHISKEY), to form MANY and (SAILORS DRINK WHISKEY).

Variables To make X stand for the number 7, say:

(SETQ X 7)

Then if you say —

(PLUS X 2)

the computer will print 9.

To make Y stand for the word LOVE, say:


Then if you say —


the computer will say:


To make STOOGES stand for the list (MOE LARRY CURLEY), say:


Then if you say —


the computer will say:


To find the first of the STOOGES, say:


The computer will say:


Your own functions You can define your own functions. For example, you can define (DOUBLE X) to be 2*X, by typing this:


       (TIMES 2 X)


Then if you say —


the computer will print:


REPEAT Let’s define REPEAT to be a function, so that (REPEAT ‘LOVE 5) is (LOVE LOVE LOVE LOVE LOVE), and (REPEAT ‘KISS 3) is (KISS KISS KISS), and (REPEAT ‘KISS 0) is ().

If N is 0, we want (REPEAT X N) to be ().

If N is larger than 0, we want (REPEAT X N) to be a list of N X’s.

That’s X followed by N-1 more X’s.

That’s the CONS of X with a list of N-1 more X’s.

That’s the CONS of X with (REPEAT X (DIFFERENCE N 1)).


That’s (CONS X (REPEAT X (SUB1 N))), since (SUB1 N) means N-1 in LISP.

You can define the answer to (REPEAT X N) as follows: if N is 0, the answer is (); if N is not 0, the answer is (CONS X (REPEAT X (SUB 1 N))). Here’s how to type that definition:



             ((ZEROP N) ())

             (T (CONS X (REPEAT X (SUB1 N))))



The top line says you’re going to DEfine a FUNction called REPEAT (X N). The next line says the answer depends on CONDitions. The next line gives one of those conditions: if N is ZERO, the answer is (). The next line says: otherwise, the value is (CONS X (REPEAT X (SUB1 N))). The next line closes the parentheses opened in the second line. The bottom line closes the parentheses opened in the top line.

Then if you type —


the computer will print:


The definition is almost circular: the definition of REPEAT assumes you already know what REPEAT is. For example:

(REPEAT ‘KISS 3) is defined as the CONS of KISS with the following:

(REPEAT ‘KISS 2), which is defined as the CONS of KISS with the following:

(REPEAT ‘KISS 1), which is defined as the CONS of KISS with the following:

(REPEAT ‘KISS 1), which is defined as the CONS of KISS with the following:

(REPEAT ‘KISS 0), which is defined as ().

That kind of definition, which is almost circular, is called recursive.

You can say “The definition of REPEAT is recursive”, or “REPEAT is defined recursively”, or “REPEAT is defined by recursion”, or “REPEAT is defined by induction”, or “REPEAT is a recursive function”.

LISP was the first popular language that allowed recursive definitions.

When the computer uses a recursive definition, the computer refers to the definition repeatedly before getting out of the circle. Since the computer repeats, it’s performing a loop. In traditional BASIC and FORTRAN, the only way to make the computer perform a loop is to say GO TO or FOR or DO. Although LISP contains a go-to command, LISP programmers avoid it and write recursive definitions instead.

ITEM As another example of recursion, let’s define the function ITEM so that (ITEM N X) is the Nth item in list X, and so that (ITEM 3 ‘(MANY SAILORS DRINK WHISKEY)) is the 3rd item of (MANY SAILORS DRINK WHISKEY), which is DRINK.

If N is 1, (ITEM N X) is the first item in X, which is the CAR of X, which is (CAR X).

If N is larger than 1, (ITEM N X) is the Nth item in X. That’s the (N-1)th item in the CDR of X. That’s (ITEM (SUB1 N) (CDR X)).

So define (ITEM N X) as follows: if N is 1, the answer is (CAR X); if N is not 1, the answer is (ITEM (SUB 1 N) (CDR X)). Here’s what to type:



             ((ONEP N) (CAR X))

             (T (ITEM (SUB1 N) (CDR X)))



If your computer doesn’t understand (ONEP N), say (EQUAL 1 N) instead.


SNOBOL lets you analyze strings more easily than any other language. It can handle numbers also.

Simple example Here’s a simple SNOBOL program:

        A = -2

        B = A + 10.6


        OUTPUT = "MY " C


When you type the program, indent each line except END. Indent at least one space; you can indent more spaces if you wish. Put spaces around the symbol =, the symbol +, and other operations.

The first line says A is the integer -2. The next line says B is the real number 8.6. The next line says C is the string “BODY TEMPERATURE IS 98.6”. The next line makes the computer print:


In SNOBOL, a variable’s name can be short (like A or B or C) or as long as you wish. The variable’s name can even contain periods, like this:


Looping This program’s a loop:


        OUTPUT = "DOG" :(FRED)


The first line (whose name is FRED) makes the computer print:


The next line makes the computer print —


and then go to FRED. Altogether the computer will print:








Replacing SNOBOL lets you easily replace one phrase by another.

        X = "SIN ON A PIN WITH A DIN"

        X "IN" = "UCK"

        OUTPUT = X


The first line says X is the string “SIN ON A PIN WITH A DIN”. The next line says: in X, replace the first “IN” by “UCK”. So X becomes “SUCK ON A PIN WITH A DIN”. The next line says the output is X, so the computer will print:


That program changed the first “IN” to “UCK”. Here’s how to change every “IN” to “UCK”:

        X = "SIN ON A PIN WITH A DIN"

        X "IN" = "UCK"

        X "IN" = "UCK"

        X "IN" = "UCK"

        OUTPUT = X


The first line says X is “SIN ON A PIN WITH A DIN”. The second line replaces an “IN” by “UCK”, so X becomes “SUCK ON A PIN WITH A DIN”. The next line replaces another “IN” by “UCK”, so X becomes “SUCK ON A PUCK WITH A DIN”. The next line replaces another “IN”, so X becomes “SUCK ON A PUCK WITH A DUCK”, which the next line prints.

This program does the same thing:

        X = "SIN ON A PIN WITH A DIN"

LOOP    X "IN" = "UCK" :S(LOOP)

        OUTPUT = X


The first line says X is “SIN ON A PIN WITH A DIN”. The next line replaces “IN” successfully, so X becomes “SUCK ON A PIN WITH A DIN”. At the end of the line, the :S(LOOP) means: if Successful, go to LOOP. So the computer goes back to LOOP. The computer replaces “IN” successfully again, so X becomes “SUCK ON A PUCK WITH A DIN”, and the computer goes back to LOOP. The computer replaces “IN” successfully again, so X becomes “SUCK ON A PUCK WITH A DUCK”, and the computer goes back to LOOP. The computer does not succeed. So the computer ignores the :S(LOOP) and proceeds instead to the next line, which prints:


Deleting This program deletes the first “IN”:

        X = "SIN ON A PIN WITH A DIN"

        X "IN" =

        OUTPUT = X


The second line says to replace an “IN” by nothing, so the “IN” gets deleted. X becomes “S ON A PIN WITH A DIN”, which the computer will print.

This program deletes every “IN”:

        X = "SIN ON A PIN WITH A DIN"

LOOP    X "IN" = :S(LOOP)

        OUTPUT = X


The computer will print:


Counting Let’s count how often “IN” appears in “SIN ON A PIN WITH A DIN”. To do that, delete each “IN”; but each time you delete one, increase the COUNT by 1:

        X = "SIN ON A PIN WITH A DIN"

        COUNT = 0


        COUNT = COUNT + 1 :(LOOP)



The third line tries to delete an “IN”: if successful, the computer proceeds to the next line, which increases the COUNT and goes back to LOOP; if failing (because no “IN” remains), the computer goes to ENDING, which prints the COUNT. The computer will print:


How SNOBOL developed At MIT during the 1950’s, Noam Chomsky invented a notation called transformational-generative grammar, which helps linguists analyze English and translate between English and other languages. His notation was nicknamed “linguist’s algebra”, because it helped linguists just as algebra helped scientists. (A decade later, he became famous for also starting the rebellion against the Vietnam War.)

Chomsky’s notation was for pencil and paper. In 1957 and 1958, his colleague Victor Yngve developed a computerized version of Chomsky’s notation: the computerized version was a language called COMIT. It was nicknamed “linguist’s FORTRAN”, because it helped linguists just as FORTRAN helped engineers.

COMIT manipulated strings of words. In 1962 at Bell Telephone Laboratories (Bell Labs), Chester Lee invented a variant called the Symbolic Communication Language (SCL), which manipulated strings of mathematical symbols instead of words and helped mathematicians do abstract mathematics.

A team at Bell Labs decided to invent a language similar to SCL, but easier to learn and including features from COMIT. At first, they called their new language “SCL7”, because it resembled SCL. Then they changed its name to “SEXI” (which stands for String EXpression Interpreter), but the management of Bell Labs didn’t like sex. Then, as a joke, they named it SNOBOL, using the flimsy excuse that SNOBOL stands for StriNg-Oriented symBOlic Language.

Cynics jeered that SNOBOL didn’t have “a snowball’s chance in Hell”. But the cynics were wrong, and SNOBOL became popular. It was used mainly for writing programs that translate between computer languages. (For example, you could write a SNOBOL program that translates FORTRAN into BASIC.)

Which is better: COMIT or SNOBOL?

People who like Chomsky’s notation (such as linguists) prefer COMIT. People who like algebra (such as scientists) prefer SNOBOL.

SNOBOL’s supporters were more active than COMIT’s: they produced SNOBOL 2, SNOBOL 3, SNOBOL 4, and SNOBOL 4B, taught SNOBOL to the newest computers, wrote many books about SNOBOL, and emphasized that SNOBOL can solve any problem about strings, even if the problem had nothing to do with linguistics. They won: most people use SNOBOL instead of COMIT, though COMIT might still make a comeback.

Now most versions of SNOBOL are named after baseball pitching methods — such as FASBOL, SLOBOL, and SPITBOL. (SPITBOL stands for SPeedy ImplemenTation of snoBOL.)


APL lets you manipulate lists of numbers more easily than any other language.

APL uses special characters that aren’t on a normal keyboard.









To compute 8+9, type this:


Notice the line is indented. Whenever it’s your turn to type, the computer automatically indents the line for you.

When you press the RETURN key at the end of that line, the computer will print the answer. (You don’t have to say PRINT or any other special word.) The computer will print:


Scalar operators APL uses these scalar operators:

APL name   Symbol    Meaning

PLUS              A+B    add

identity           +B   same as just B

MINUS            A-B   subtract

negative              -B   negative

TIMES            A×B    multiply

signum             ×B   1 if B>0; -1 if B<0; 0 if B=0

DIVIDE       A÷B    divide

reciprocal        ÷B   1 divided by B

POWER          A*B    A raised to the Bth power; AB

exponential     *e raised to the Bth power, where e is 2.718281828459045

LOG                A*oB    logarithm, base A, of B

natural log       *ologarithm, base e, of B

CEILING         é   B rounded up to an integer

maximum        AéB       A or B, whichever is larger

FLOOR           ë   B rounded down to an integer

minimum         AëB       A or B, whichever is smaller

MAGNITUDE |B   the absolute value of B

residue             A|B   the remainder when you divide A into B; so 4|19 is 3

FACTORIAL   !B   1 times 2 times 3 times 4 times… times B

combinations   A!B   how many A-element subsets you can form from a set of B

ROLL              ?B   a random integer from 1 to B

deal                 A?B    list of A random integers, each from 1 to B, no duplicates

PI TIMES       op times B

circular            Aosin  B if A=1         arcsin    B if A=-1

                               cos  B if A=2         arccos    B if A=-2

                               tan  B if A=3         arctan       B if A=-3

                               sinh    B if A=5         arcsinh  B if A=-5

                               cosh   B if A=6         arccosh  B if A=-6

                                  tanh   B if A=7         arctanh  B if A=-7

                                                                   square root of 1+B2     if A= 4

                                                                   square root of 1-B2 if A= 0

                                                                   square root of B2-1 if A=-4

EQUAL       A=B    1 if A equals B;                                 otherwise 0

not equal         A=B      1 if A is not equal to B;                 otherwise 0

LESS               A<B    1 if A is less than B;                         otherwise 0

less or equal     A<B    1 if A is less than or equal to B;        otherwise 0

GREATER       A>B    1 if A is greater than B;                    otherwise 0

greater or equal   A>B    1 if A is greater than or equal to B;   otherwise 0

AND               A^B    1 if A and B are both 1;                    otherwise 0

nand                A^~B      1 if A and B are not both 1;              otherwise 0

OR                  AvB    1 if A or B is 1;                                otherwise 0

nor                  Av~B      1 if neither A nor B is 1;                  otherwise 0

NOT               ~B   1 if B is 0;                                         otherwise 0

To make the symbol *o, type the symbol *, then press the BACKSPACE key, then type the symbol o.

Order of operations Unlike all other popular languages, APL makes the computer do all calculations from right to left. For example, if you type —


the computer will start with 5, add 3 (to get 8), and then multiply by 2 (to get 16). The computer will print:


In BASIC and most other languages, the answer would be 11 instead.

If you type —


the computer will start with 3, subtract it from 4 (to get 1), and then subtract from 9 (to get 8). The computer will print:


In most other languages, the answer would be 2 instead.

You can use parentheses. Although 9-4-3 is 8, (9-4)-3 is 2.

Compare these examples:

-4+6 is -10

-4+6 is 2

In both examples, the 4 is preceded by a negative sign; but in the second example, the negative sign is raised, to be as high as the 4. (To make the raised negative, tap the 2 key while holding down the SHIFT key. To make a regular negative, tap the + key while holding down the SHIFT key.) The first example makes the computer start with 6, add 4 (to get 10), and then negate it (to get -10). The second example makes the computer start with 6 and add -4, to get 2.

Double precision APL is super-accurate. It does all calculations by using double precision.

Variables You can use variables:



The first line says X is 3. The second line makes the computer print X+2. The computer will print:


A variable’s name can be long: up to 77 letters and digits. The name must begin with a letter.

Vectors A variable can stand for a list of numbers:

      Y5 2 8


The first line says Y is the vector 5 2 8. The next line makes the computer add 1 to each item and print:

6  3  9

This program prints the same answer:

      5 2 8+1

The computer will print:

6  3  9

This program prints the same answer:

      1+5 2 8

You can add a vector to another vector:

      A5 2.1 6

      B3 2.8 -7


The computer will add 5 to 3, and 2.1 to 2.8, and 6 to - 7, and print:

8  4.9  -1

This program prints the same answer:

      5 2.1 6+3 2.8 -7

This program prints the same answer:

      A5 2.1 6

      B3 2.8 -7



Here’s something different:

      X4 2 3


The first line says X is the vector 4 2 3. The next line makes the computer print the sum, 9.

This program prints the same answer:

      Y+/4 2 3


You can combine many ideas on the same line, but remember that the computer goes from right to left:

      219-1 4 3+6×+/5 1 3×2 4 7

The computer will start with 2 4 7, multiply it by 5 1 3 (to get 10 4 21), find the sum (which is 35), multiply by 6 (to get 210), add 1 4 3 (to get 211 214 213), and then subtract from 219 (to get 8 5 6). The computer will print:

8  5  6

Each of APL’s scalar operators works like addition. Here are examples:

2 4 10×3 7 9  is 6 28 90

÷2 4 10         is .5 .25 .1

-2 4 10         is -2 -4 -10

×/2 4 10        is 2×4×10, which is 80

-/9 5 3         is 9-5-3, which is 7 (since the computer works from right to left)

ë/6.1 2.7 4.9    is 6.1ë2.7ë4.9, which is 2.7 (since ë means minimum)

ë6.1 2.7 4.9    is ë6.1 then ë2.7 then ë4.9, which is 6 2 4 (since ë means floor)

Vector operators Here are vector operators; the examples assume V is 8 5 6:

APL name     Symbol               Value         Reason

SHAPE            ρV           3                  V has 3 items

reshape            7ρV           8 5 6 8 5 6 8   make 7 items from V

REVERSE    |oV          6 5 8            reverse V

rotate              1|oV          5 6 8            rotate V, by beginning after the 1st item

GENERATE i3            1 2 3            count up to 3

index of           Vi5            2                  in V, find 5; it’s the 2nd item

TAKE             2­V           8 5               the first 2 items from V

drop                2¯V           6                  omit the first two items from V

SUBSCRIPT V[2]        5                  V’s 2nd item

catenate              V,9 4       8 5 6 9 4      V followed by 9 4

COMPRESS 1 0 1/V       8 6               take part of V, using this pattern: take, omit, take

expand            1 0 0 1 1\V    8 0 0 5 6      insert zeros into V, using this pattern: item, 0, 0, item, item

GRADE UP     |DV          2 3 1            here are V’s numbers in increasing order:

                                                            5 (V’s 2nd number), 6 (V’s 3rd), 8 (V’s 1st)

grade down      |ÑV         1 3 2           here are V’s numbers in decreasing order:

                                                            8 (V’s 1st number), 6 (V’s 3rd), 5 (V’s 2nd)

DECODE        10V         856             8, times 10, plus 5, times 10, plus 6

encode             10856         8 5 6           opposite of decode

MEMBER    5εV           1                 search for 5 in V (1=found, 0=missing)

Love or hate? Some programmers love APL, because its notation is brief. Other programmers hate it, because its notation is hard for a human to read. The haters are winning, and the percentage of programmers using APL is decreasing.


LOGO began in 1967, during an evening at Dan Bobrow’s home in Belmont, Massachusetts.

Dan had gotten his Ph.D. from MIT and was working for a company called Bolt, Beranek, and Newman (BBN). In his living room were three of his colleagues from BBN (Wally Feurzeig, Cynthia Solomon, and Dick Grant) and an MIT professor: Seymour Papert.

BBN had tried to teach young kids how to program by using BBN’s own language (TELCOMP), which was a variation of JOSS. BBN had asked Professor Seymour Papert for his opinion. The group was all gathered in Dan’s house to hear Seymour’s opinion.

Seymour chatted with the group, and the entire group agreed with Seymour on several points:

First, TELCOMP was not a great language for kids. It placed too much emphasis on mathematical formulas. The group agreed that instead of struggling with math, the kids ought to have more fun by programming the computer to handle strings instead.

The group also agreed that the most sophisticated language for handling strings was LISP, but that LISP was too complex for kids. The group concluded that a new, simplified LISP should be invented for kids, and that it should be called “LOGO”.

That’s how LOGO began. Professor Seymour Papert was the guiding light, and all the other members of the group gave helpful input during the conversation.

That night, after his guests left, Dan went to the terminal in his bedroom and started programming the computer to understand LOGO. Specifically, he wrote a LISP program that explained to the computer how to handle LOGO. That’s how LOGO was born.

Work on LOGO continued. The three main researchers who continued improving LOGO were Seymour (the MIT guru), Wally (from BBN), and Cynthia (also from BBN). LOGO resembled LISP but required fewer parentheses.

After helping BBN for a year, Seymour returned to MIT. Cynthia and several other BBN folks worked with him at MIT’s Artificial Intelligence Laboratory to improve LOGO.

Turtles At first, LOGO was as abstract and boring as most other computer languages. But in the spring of 1970, a strange creature walked into the LOGO lab. It was a big yellow mechanical turtle. It looked like “half a grapefruit on wheels” and had a pen in its belly:







It also had a horn, feelers, and several other fancy attachments. To use it, you put paper all over the floor and then programmed it to roll across the paper. As it rolled, the pen in its belly drew pictures on the paper. The turtle was controlled remotely by a big computer programmed in LOGO.

Suddenly, LOGO became a fun language whose main purpose was to control the turtle. Kids watching the turtle screamed with delight and wanted to learn how to program it. LOGO became a favorite programming game for kids. Even kids who were just 7 years old started programming in LOGO. Those kids were barely old enough to read, but reading and writing were not prerequisites for learning how to program in LOGO. All the kids had to know was that “FD 3” made the turtle go forward 3 steps, and “RT 30” made the turtle turn to the right 30 degrees.

As for the rest of LOGO — all that abstract stuff about strings and numbers and LISP-like lists — the kids ignored it. They wanted to use just the commands “FD” and “RT” that moved the turtle.

The U.S. Government’s National Science Foundation donated money, to help MIT improve LOGO further. Many kids came into the LOGO lab to play with the turtles.

The turtles were expensive, and so were the big computers that controlled them. To let more kids use LOGO, the first problem was to reduce the cost of the turtle and its controlling computer.

During the early 1970’s, computer screens got dramatically cheaper. To save money, MIT stopped building mechanical turtles and instead bought cheap computer screens that showed pictures of turtles. Those pictures were called “mock turtles”.

Cheaper computers The original version of LOGO was done on BBN’s expensive weird computer (the MTS 940). Later versions were done on the PDP-1 (in 1968), the PDP-10 (in 1970), and finally on a cheaper computer: the PDP-11 minicomputer (in 1972).

At the end of the 1970’s, companies such as Apple and Radio Shack began selling microcomputers, which were even cheaper. MIT wanted to put LOGO on microcomputers but ran out of money to pay for the research.

Texas Instruments (TI) came to the rescue.…

TI LOGO TI agreed to pay MIT to research how to put LOGO on TI’s microcomputers (the TI-99/4 and the TI-99/4A).

TI and MIT thought the job would be easy, since MIT had already written a PASCAL program that made the computer understand LOGO, and since TI had already written a version of PASCAL for the CPU chip inside the TI-99/4. Initially, MIT was worried because the PASCAL program running on MIT’s PDP-10 computer handled LOGO too slowly; but TI claimed TI’s PASCAL was faster than the PDP-10’s and that LOGO would therefore run fast enough on the TI.

TI was wrong. TI’s PASCAL couldn’t make LOGO run fast enough, and TI’s PASCAL also required too much RAM. So TI had to take MIT’s research (on the PDP-10) and laboriously translate it into TI’s assembly language, by hand.

The hand translation went slower that TI expected. TI became impatient and took a short-cut: it omitted parts of LOGO, such as decimals. TI began selling its version of LOGO, which understood just integers.

MIT Apple LOGO After TI started selling its LOGO, the MIT group invented a version of LOGO for the Apple. The Apple version included decimals. But alas, the Apple version omitted “sprites” (which are animated creatures that carry objects across the screen) because Apple’s hardware couldn’t handle sprites fast enough. (TI’s hardware was fancier and did handle sprites.)

MIT wanted to sell the Apple version to schools since more schools owned Apples than TI computers. But if MIT were to make lots of money from selling the Apple version, MIT might get into legal trouble, since MIT was supposed to be non-profit. And anyway, who “owned” LOGO? Possible contenders were:

MIT, which did most of the research

BBN, which trademarked the name “LOGO” and did the early research

Uncle Sam, whose National Science Foundation paid for much research

TI, which also paid for much research

Eventually, MIT solved the legal problems and sold the rights for “MIT Apple LOGO” to two companies: Krell and Terrapin.

Krell was strictly a marketing company. It sold MIT Apple LOGO to schools but made no attempt to improve LOGO further.

Terrapin, on the other hand, was a research organization that had built mechanical turtles for several years. Terrapin hired some MIT graduates to improve LOGO further.

LCSI versus competitors Back when MIT was asking its lawyers to determine who owned Apple LOGO, a group of MIT’s faculty and students became impatient. The group, headed by Cynthia Solomon (one of the original inventors of LOGO), left MIT and formed a company called LOGO Computer Systems Incorporated (LCSI). That company invented its own version of LOGO for the Apple.

LCSI became quite successful. Apple, IBM, Atari, and Microsoft all hired LCSI to write versions of LOGO. Commodore hired Terrapin instead.

If you have an Apple 2c (or 2e or 2+), you can buy either the official Apple LOGO (sold by Apple Computer Inc. and created by LCSI), or “Terrapin LOGO for the Apple” (sold by Terrapin), or the original “MIT LOGO for the Apple” (sold by Krell).

Krell has become less popular. That leaves just two major players: Terrapin and LCSI. Generally speaking, LCSI’s versions of LOGO are daring — LCSI tried wild experiments — while Terrapin’s versions of LOGO are conservative — closer to the MIT original.

The two companies have different styles. Terrapin is small and friendly and charges very little. LCSI is large, charges more, and is often rude. Terrapin gives more help to customers on the phone than LCSI.

The original owners of Terrapin had financial difficulties, moved to Maine, then sold the company to Harvard Associates (a Massachusetts company that had invented a LOGO version called “PC LOGO”). So now Terrapin is part of Harvard Associates, which is run by Bill Glass, a friendly guy. To find out about his Terrapin LOGO, look at his Web site ( then phone him at 800-774-Logo (or 617-547-Logo) or write to 10 Holworthy St., Cambridge MA 02138.

LCSI’s newest, daring version of LOGO is MicroWorlds Pro. To find out about it, look at LCSI’s Web site ( then phone LCSI at 800-321-5646. LCSI is based in Montreal, Canada, but accepts US mail at PO Box 162, Highgate Springs VT 05460.

LOGO versus BASIC Most of LOGO’s designers hate BASIC. They believe BASIC should be eliminated from schools altogether.

They believe LOGO is easier to learn than BASIC, and that LOGO encourages a kid to be more creative. They also believe that LOGO leads the kid to think in a more organized fashion than BASIC. They also argue that since LOGO is best for little kids, and since switching languages is difficult, the kids should continue using LOGO until they graduate from high school and should never use BASIC.

That argument is wrong. It ignores the fact that a knowledge of BASIC is essential to surviving in our computerized society. Today, most programs are still written in BASIC, not LOGO, because BASIC consumes less RAM and because BASIC’s newest versions contain many practical features for business and science and graphics that LOGO lacks.

Another advantage of BASIC over LOGO is that LOGO suffers from awkward notation. For example, in BASIC you can type a formula such as —


but in LOGO you must type:


Notice how ugly the LOGO command looks! Notice you must put a quotation mark before the A but must not but a quotation mark afterwards! And look at those frightful colons! Anybody who thinks such notation is great for kids is a fool.

Extensible One of the nicest things about LOGO is that you can change it and turn it into your own language! That’s because LOGO lets you invent your own commands and add them to the LOGO language. A language (such as LOGO) that lets you invent your own commands is called an extensible language. Although some earlier languages (such as LISP) were extensible also, LOGO is more extensible and more pleasant.


Like LOGO, FORTH is extensible. But FORTH has two advantages over LOGO:

1. FORTH consumes less memory. You can easily run FORTH on a computer having just 8K of RAM.

2. FORTH runs faster. The computer handles FORTH almost as fast as assembly language.

Since FORTH is extensible and consumes so little of the computer’s memory and time, professional programmers use it often. Famous programs written in FORTH include Easywriter (which is a word-processing program for the Apple and the IBM Personal Computer), Valdocs (which is the operating system for Epson’s first computer), and Rapid File (an easy-to-learn data-management system developed by Miller Microcomputer Systems and sold by Ashton-Tate).

Unfortunately, the original versions of Easywriter and Valdocs contained many bugs, but that’s because their programmers were careless.

In FORTH, if you want to add 2 and 3 (to get 5) you do not type 2+3. Instead, you must type:

2 3 +

The idea of putting the plus sign afterwards (instead of in the middle) is called postfix notation. The postfix notation (2 3 +) has two advantages over infix notation (2+3): the computer handles postfix notation faster, and you never need to use parentheses for “order of operations”. On the other hand, postfix notation seems inhuman: it’s hard for a human to read.

Like FORTH, Hewlett-Packard pocket calculators use postfix notation. So if you’ve already had experience with a Hewlett-Packard calculator, you’ll find FORTH easy.

Postfix notation is the reverse of prefix notation (+ 2 3), which was invented around 1926 by the Polish mathematician Lukasiewicz. So postfix notation is often called reverse Polish notation.

Since FORTH is so difficult for a human to read, cynics call it “an inhuman Polish joke”.

FORTH was invented by Chuck Moore, during his spare time while he worked at many schools and companies. He wanted to name it “FOURTH”, because he considered it to be an ultra-modern “fourth-generation” language. Since he was using an old IBM 1130 minicomputer, which couldn’t handle a name as long as “FOURTH”, he omitted the letter “U”.


PILOT was invented at the San Francisco branch of the University of California, by John Starkweather in 1968. It’s easier to learn than BASIC, but it’s intended to be used by teachers instead of students. Teachers using PILOT can easily make the computer tutor students about history, geography, math, French, and other schoolbook subjects.

For example, suppose you’re a teacher and want to make the computer chat with your students. Here’s how to do it in BASIC, and more easily in PILOT:

BASIC program

10 CLS






PILOT program                            What the computer will do



A:                        Accept the human’s answer.

M:YE,SURE                 Match. (See whether answer contains “YE” or “SURE”.)

TY:I LIKE YOU TOO         If there was a match, type “I LIKE YOU TOO”.

TN:TOUGH LUCK             If no match, type “TOUGH LUCK”.

Notice that the PILOT program is briefer than BASIC.

Atari, Apple, and Radio Shack all sell versions of PILOT that include commands to handle graphics. Atari’s version is the best, since it includes the fanciest graphics and music and even a LOGO-like turtle, and since it’s also the easiest version to learn how to use.

Although PILOT is easier than BASIC, most teachers prefer to learn BASIC because BASIC is available on more computers, costs less, and accomplishes a greater variety of tasks. Hardly anybody uses PILOT.


For specialized applications, use a special language.


If you use APT, the computer will help you cut metal.

Type an APT program that says how you want the metal cut. When you run the program, the computer will create a special instruction tape. If you feed that tape into a metal-cutting machine, the machine will cut metal as you said.

Let’s write an APT program that makes the machine cut out the shaded area:

















We’ll make the machine move the cutter where the circles are.

Here’s the program:

Program                                                                   What the computer will do

CUTTER/1                            Use a cutter whose diameter is 1".

TOLER/.005                          The tolerance of the cut is .005".

FEDRAT/80                           Use a feedrate of 80" per minute.

HEAD/1                              Use head 1.

MODE/1                              Operate the tool in mode 1.

SPINDL/2400                       Turn the spindle on, at 2400 rpm.

COOLNT/FLOOD                      Turn the coolant on, at flood setting.

PT1=POINT/4,5                     PT1 = the point whose coordinates are (4,5).

FROM/(SETPT=POINT/1,1)            SETPT = point (1,1). Start tool from SETPT.

INDIRP/(TIP=PIONT/1,3)            TIP = (1,3). Aim tool in direction of TIP.

BASE=LINE/TIP, AT ANGL, 0         BASE = line going through TIP at 0 degrees.

GOTO/BASE                           Make the tool go to BASE.

TL RGT, GO RGT/BASE               With tool on right, go right along BASE.

GO FWD/(ELLIPS/CENTER, PT1, 3,2,0) Go forward along ellipse whose center is PT1,

                                                                                   semi-major axis is 3", semi-minor axis is 2",

                                                                                    and major axis slants 0 degrees.

GO LFT/(LINE/2,4,1,3,), PAST, BASE Go left along the line that joins (2,4) and (1,3),

                                                                                   until you get past BASE.

GOTO/SETPT                          Make the tool go to SETPT.

COOLNT/OFF                          Turn the coolant off.

SPINDL/OFF                          Turn the spindle off.

END                                 End use of the machine.

FINI                              The program is finished.


DYNAMO uses these symbols:

Symbol      Meaning

.J       a moment ago

.K       now

.JK      during the past moment

.KL      during the next moment

DT       how long “a moment” is

For example, suppose you want to explain to the computer how population depends on birth rate. If you let P be the population, BR be the birth rate, and DR be the death rate, here’s what to say in DYNAMO:


The equation says: Population now = Population before + (how long “a moment” is) times (Birth Rate during the past moment - Death Rate during the past moment).

World Dynamics The most famous DYNAMO program is the World Dynamics Model, which Jay Forrester programmed at MIT in 1970. His program has 117 equations that describe 112 variables about our world.

Here’s how the program begins:




C PI=1.65E9



The first line gives the program’s title. The next line defines the Level of Population, in terms of Birth Rate and Death Rate.

The second equation defines the iNitial Population to be PI (Population Initial). The next equation defines the Constant PI to be 1.65e9, because the world’s population was 1.65 billion in 1900.

The next equation says the Rate BR.KL (the Birth Rate during the next moment) is determined by the Population now and several other factors, such as the BRFM (Birth-Rate-from-Food Multiplier), the BRMM (Birth-Rate-from-Material Multiplier), the BRCM (Birth-Rate-from-Crowding Multiplier), and the BRPM (Birth-Rate-from-Pollution Multiplier). Each of those factors is defined in later equations.

When you run the program, the computer automatically solves all the equations simultaneously and draws graphs that show how the population, birth rate, etc. will change during this century and the next. Here are some of the results:



















The graph shows the quality of life will decrease because of the overpopulation, pollution, and dwindling natural resources. Although the material standard of living will improve for a while, it too will eventually decrease, as will industrialization (capital investment).

Dwindling natural resources are the main problem. Suppose scientists suddenly make a new discovery that lets us reduce our usage of natural resources by 75%. Will our lives be better?

Here’s what the computer predicted would happen, if the “new discovery” were made in 1970:



















In that picture, you see the graph of natural resources changing sharply in 1970, because of the new scientific discovery. As a result, people live well, so that in 2030 the population is almost 4 times what it was in 1970. But the large population generates too much pollution; in 2030, the pollution is being created faster than it can dissipate. From 2040 to 2060, a pollution crisis occurs: the pollution increases until it is 40 times as great as in 1970; then most people on earth die, so that the world population in 2060 is a sixth of what it was in 2040. After the crisis, the few survivors create little pollution and enjoy a very high quality of life.

Forrester tried other experiments on the computer. To improve the quality of life, he tested the effect of requiring birth control, reducing pollution, and adopting other strategies. Each of them backfired. The graphs showed that the only way to maintain a high quality of life throughout the next century is to adopt a combination strategy now:

reduce natural resource usage by 75%

reduce pollution generation by 50%

reduce the birth rate by 30%

reduce capital-investment generation by 40%

reduce food production by 20%

Other popular applications Although the World Dynamics Model is DYNAMO’s most famous program, DYNAMO has also been applied to many other problems.

The first DYNAMO programs ever written were aimed at helping managers run companies. Just plug your policies about buying, selling, hiring, and firing into the program’s equations; when you run the program, the computer draws a graph showing what will happen to your company during the coming months and years. If you don’t like the computer’s prediction, change your policies, put them into the equations, and see whether the computer’s graphs are more optimistic.

How DYNAMO developed DYNAMO developed from research at MIT.

At MIT in 1958, Richard Bennett invented a language called SIMPLE, which stood for “Simulation of Industrial Management Problems with Lots of Equations”. In 1959, Phyllis Fox and Alexander Pugh III invented DYNAMO as an improvement on SIMPLE. At MIT in 1961, Jay Forrester wrote a book called Industrial Dynamics, which explained how DYNAMO can help you manage a company.

MIT is near Boston, whose mayor from 1960 to 1967 was John Collins. When his term as mayor ended, he became a visiting professor at MIT. His office happened to be next to Forrester’s. He asked Forrester whether DYNAMO could solve the problems of managing a city. Forrester organized a conference of urban experts and got them to turn urban problems into 330 DYNAMO equations involving 310 variables.

Forrester ran the program and made the computer graph the consequences. The results were surprising:

The graph showed that if you try to help the underemployed by giving them low-cost housing, job-training programs, and artificially-created jobs, here’s what happens: as the city becomes better for the underemployed, more underemployed people move to the city. Then the percentage of the city that is underemployed increases, and the city is worse than before the reforms were begun. In other words, socialist reform just backfires.

Another example: free public transportation creates more traffic, because it encourages people to live farther from their jobs.

Instead, the graphs show the only long-term solution to the city’s problems is to knock down slums, fund new “labor-intensive export” businesses (businesses that will hire many workers, occupy little land, and produce goods that can be sold outside the city), and let the underemployed fend for themselves in this new environment.

Another surprise: any city-funded housing program makes matters worse — regardless of whether the housing is for the underemployed, the workers, or the rich — because additional housing means less space for industry and hence fewer jobs.

If you ever become a mayor or President, use the computer’s recommendations cautiously: they’ll improve the cities, but only by driving the underemployed out to the suburbs, which will worsen.

In 1970 Forrester created the World Dynamics Model to help “The Club of Rome”, a private club of 75 people who try to save the world from ecological calamity.


A queue is a line of people who are waiting. GPSS analyzes queues. For example, let’s use GPSS to analyze the customers waiting in “Quickie Joe’s Barbershop”.

Joe’s the only barber in the shop, and he spends exactly 7 minutes on each haircut. (That’s why he’s called “Quickie Joe”.)

About once every 10 minutes, a new customer enters the barbershop. More precisely, the number of minutes before another customer enters is a random number between 5 and 15.

To make the computer imitate the barbershop and analyze what happens to the first 100 customers, type this program:


       GENERATE   10,5    A new customer comes every 10 minutes ± 5 minutes.

       QUEUE      JOEQ    He waits in the queue, called JOEQ.

       SEIZE      JOE     When his turn comes, he seizes JOE,

       DEPART     JOEQ        which means he leaves the JOEQ.

       ADVANCE    7       After 7 minutes go by,

       RELEASE    JOE         he releases JOE (so someone else can use JOE)

       TERMINATE  1           and leaves the shop.

       START      100     Do all that 100 times.


Indent so that the word SIMULATE begins in column 8 (preceded by 7 spaces) and the “10,5” begins in column 19.

When you run the program, the computer will tell you the following.…

Joe was working 68.5% of the time. The rest of the time, his shop was empty and he was waiting for customers.

There was never more than 1 customer waiting. “On the average”, .04 customers were waiting.

There were 101 customers. (The 101st customer stopped the experiment.) 79 of them (78.2% of them) obtained Joe immediately and didn’t have to wait.

The “average customer” had to wait in line .405 minutes. The “average not-immediately-served customer” had to wait in line 1.863 minutes.

How to make the program fancier Below the RELEASE statement and above the TERMINATE statement, you can insert two extra statements:

       TABULATE   1

 1     TABLE      M1,0,1,26

(Indent so that the 1 before TABLE is in column 2.) Those two statements make the computer add the following comments.

Of the 100 analyzed customers, the “average customer” spent 7.369 minutes in the shop (from when he walked in to when he walked out).

More precisely, 79 customers spend 7 minutes each, 9 customers spend 8 minutes each, 9 customers spend 9 minutes each, 2 customers spend 10 minutes each, and 1 customer had to spend 11 minutes.

The computer also prints the “standard deviation”, “cumulative tables”, and other statistical claptrap.

On your own computer, the numbers might be slightly different, depending on how the random numbers came out. To have more faith in the computer’s averages, try 1000 customers instead of 100.

Alternative languages For most problems about queues, GPSS is the easiest language to use. But if your problem is complex, you might have to use SIMSCRIPT (based on FORTRAN) or SIMULA (an elaboration of ALGOL) or SIMPL/I (an elaboration of PL/I).


RPG is the most popular language for IBM minicomputers, such as the IBM System/3, System/32, System/34, and System/36.

For example, suppose you run a company that provides male football coaches, male boxing trainers, and male strippers, and you have a file called MANHOURS containing one line for each employee:

20331ARMSTRONG,J.D. 045

21450AZUR,M.P.      102

39976BUGLE,I.M.     041

44411CHESTER,O.P.   040

On each line:

The first 5 characters contain the employee’s ID#.

Characters 6-20 contain his name.

Characters 21-23 tell how many hours he worked.

The file’s been typed on punched cards (each line on a separate card).

Let’s make the computer print the whole file onto paper, with spacing between the columns, and also print the total hours worked, like this:

20331   ARMSTRONG,J.D.    045

21450   AZUR,M.P.         102

39976   BUGLE,I.M.        041

44411   CHESTER,O.P.      040




To write the program, fill out four forms.

The first form describes the controls and files, like COBOL’s environment division. Here’s how to fill it out:






























Line 01 says “008  008”. That makes the computer reserve 8 kilobytes of memory for the program.

Line 02 describes the file MANHOURS. The “IP” means the file is for Input and is the Primary file. The “96” means each card in the file has 96 characters. The “MFCU1” means card reader #1.

Line 03 says “ADDLIST” will be the name of the Output file, which has 96 columns and will appear on the PRINTER.

The second form describes the input:




















Line 01 says the file MANHOURS is unorganized (“AA”), reading a card from the file is called “activity #01”. The remaining lines say that on each card, characters 1-5 contain MANNO, characters 6-20 contain NAME, and characters 21-23 contain HRS, which is a number having 0 digits after the decimal point.

The third form describes the calculations:
















That form says: after each occurrence of activity #01, let HRS + TOTAL be the new TOTAL, which is a 5-digit number having 0 digits after the decimal point.

The fourth form describes the output:






















That form explains how to print the file ADDLIST.

In line 01, the “D” means “here’s how to print each line of Details”. The “10   01” means “press the carriage return 1 time before you print the line, press it 0 times after you print the line, and do the printing after each occurrence of activity #01”.

Line 02 says to print MANNO so it ends in “column 5” (the 5th character on the printed line).

Line 03 says to print NAME so it ends in column 23. Since the second form said NAME requires 15 columns (15 characters), the computer will print NAME in columns 9-23.

Line 04 says to print HRS so it ends in column 29. Since the second form said HRS requires 3 columns, the computer will print HRS in columns 27-29.

In line 05, the “T” means “here’s how to print the Total”. The “30” means “press the carriage return 3 times before you print the line, and 0 times after”. The “LR” means “print it only after the last card’s been read (Last Record)”.

Line 06 says to print TOTAL so it ends in column 29. Since the third form said TOTAL requires 5 columns, the computer will print TOTAL in columns 25-29.

After you’ve filled out the four forms in longhand, type what you wrote. Here’s the RPG program:

0101 H008  008

0102 FMANHOURSIP         96            MFCU1            from the first form

0103 FADDLIST O          96            PRINTER


0202 I                                        1   5 MANNO  from the second form

0203 I                                        6  20 NAME

0204 I                                       21  230HRS

0301 C   01      HRS       ADD  TOTAL     TOTAL   50       from the third form

0401 OADDLIST D 10     01

0402 O                         MANNO      5

0403 O                         NAME      23             from the fourth form

0404 O                         HRS       29

0405 O        T 30     LR

0406 O                         TOTAL     29

To do that in BASIC, FORTRAN, or traditional COBOL, you’d have to write a loop; you’d have to say GO TO, DO, or PERFORM. RPG makes the computer do loops automatically, without forcing you to specify how. The order in which you write statements is less important in RPG than in those other languages; you’re less likely to err; RPG is more reliable.

But today, RPG is considered old-fashioned, since newer languages (such as DBASE) let you generate loops, totals, and reports even more easily than RPG. Moreover, DBASE costs less than RPG and can run on cheaper computers.


The most popular computer language for statistics is SPSS, which stands for Statistical Package for the Social Sciences.

Simple example Suppose you survey 10 of your friends and ask each of them two questions:

1. In the next election, will you probably vote Republican or Democrat?

2. Are you male or female?

Maybe you can guess the answer to the second question by just looking at the person; but to be sure, you’d better ask.

Suppose nobody gives an unusual answer (such as Prohibitionist or Communist or Transsexual or Undecided). You think it would be cool to feed all the data into the computer. For example, if a person said “Republican Female”, you’d feed the computer this line:


If a person said “Democrat Male”, you’d feed the computer this line:


This SPSS program makes the computer analyze the data:

Program                                                                   Meaning

VARIABLE LIST  PARTY,SEX          Read each person’s PARTY and SEX,

INPUT FORMAT   FIXED (2A1)          using this FORTRAN FORMAT: “2A1”.

N OF CASES     10                There are 10 people.

INPUT MEDIUM   CARD              The data to read is on the "cards" below.

PRINT FORMATS  PARTY,SEX (A)        To print the PARTY and SEX, use "A" format.

CROSSTABS      TABLES=SEX BY PARTY Print table showing how SEX relates to PARTY.

READ INPUT DATA                     The data to read is on the following lines.





DF                                 the “data cards”






FINISH                              The program is finished.

In the top line, the word PARTY begins in column 16. Most SPSS statements consist of a control field (columns 1-15) followed by a specification field (columns 16-80).

When you run the program, the computer will print this kind of table:



       R     D     TOTAL


M     │   3 │   2 │    5

      │60.0%│40.0%│ 50.0%




F     │   1 │   4 │    5

      │20.0%│80.0%│ 50.0%




COLUMN    4     6     10

 TOTAL 40.0% 60.0% 100.0%


Look at the top number in each box. Those numbers say there were 3 male Republicans, 2 male Democrats, 1 female Republican, and 4 female Democrats. The first box says: the 3 male Republicans were 60% of the males, 75% of the Republicans, and 30% of the total population.

The computer prints the table in reverse-alphabetical order: “M” before “F”, and “R” before “D”. Each row is a SEX, and each column is a PARTY. In the program, if you change “SEX BY PARTY” to “PARTY BY SEX”, each row will be a PARTY, and each column will be a SEX.

Fancy features The CROSSTABS statement has options. Here are some of them.

option 3: don’t print the row percentages (the 60.0%, 40.0%, 20.0%, and 80.0%)

option 4: don’t print the column percentages (75.0%, 33.3%, 25.0%, and 66.7%)

option 5: don’t print the total percentages (30.0%, 20.0%, 10.0% and 40.0%)

If you want options 3 and 5, put this statement under the CROSSTABS statement:

OPTIONS        3,5

The CROSSTABS statement has statistics. Here are some of them:

1. chi-square, its degrees of freedom, level of significance

2. phi or Cramer’s V

3. contingency coefficient

4. lambda, symmetric and asymmetric

5. uncertainty coefficient, symmetric and asymmetric

6. Kendall’s tau b and its level of significance

7. Kendall’s tau c and its level of significance

8. gamma

9. Somer’s D

Those statistics are numbers that help you analyze the crosstab table. If you want statistics 1 and 8, insert this statement underneath the CROSSTABS and OPTIONS statements:


It makes the computer print statistics 1 and 8 underneath the table. If you want the computer to print all 9 statistics, say:


The CROSSTABS statement is called a procedure. Here are other procedures SPSS can handle:


ANOVA           ONEWAY





FACTOR          T-TEST



Each procedure has its own OPTIONS and STATISTICS.

SPSS includes many other kinds of statements:















EDIT             SELECT IF





IF               WEIGHT





SPSS contains more statistical features than any other language. If you don’t need quite so many features, use an easier language, such as STATPAK or DATATEXT.


In 1972, PROLOG was invented in France at the University of Marseilles. In 1981, a different version of PROLOG arose in Scotland at the University of Edinburgh. In 1986, Turbo PROLOG was created in California by Borland International (which also created Turbo PASCAL).

Those versions of PROLOG are called Marseilles PROLOG, Edinburgh PROLOG, and Turbo PROLOG.

Today, PROLOG programmers call Marseilles PROLOG the “old classic”, Edinburgh PROLOG the “current standard”, and Turbo PROLOG the “radical departure”.

Turbo PROLOG has two advantages over its predecessors: it runs programs extra-fast, and it uses English words instead of weird symbols. On the other hand, it requires extra lines at the beginning of your program, to tell the computer which variables are strings.

The ideal PROLOG would be a compromise, incorporating the best features of Marseilles, Edinburgh, and Turbo. Here’s how to use the ideal PROLOG, and how the various versions differ from it.…

Creating the database PROLOG analyzes relationships. Suppose Alice loves tennis and sailing, Tom loves everything that Alice loves, and Tom also loves football (which Alice does not love). To feed all those facts to the computer, give these PROLOG commands:



loves(tom,X) if loves(alice,X).


The top two lines say Alice loves tennis and sailing. In the third line, the “X” means “something”, so that line says: Tom loves something if Alice loves it. The bottom line says Tom loves football.

When you type those lines, be careful about capitalization.

You must capitalize variables (such as X). You must not capitalize specifics (such as tennis, sailing, football, alice, tom, and love).

At the end of each sentence, put a period.

That’s how to program by using ideal PROLOG. Here’s how other versions of PROLOG differ.…

For Edinburgh PROLOG, type the symbol “:-” instead of the word “if”.

For Marseilles PROLOG, replace the period by a semicolon, and replace the word “if” by an arrow (->), which you must put in every line:



loves(tom,X) -> loves(alice,X);


For Turbo PROLOG, you must add extra lines at the top of your program, to warn the computer that the person and sport are strings (“symbols”), and the word “loves” is a verb (“predicate”) that relates a person to a sport:








        loves(tom,X) if loves (alice,X).


(To indent, press the TAB key. To stop indenting, press the left-arrow key.) When you’ve typed all that, press the ESCape key and then the R key (which means Run).

Simple questions After you’ve fed the database to the computer, you can ask the computer questions about it.

Does Alice love tennis? To ask the computer that question, type this:


The computer will answer:


Does Alice love football? Ask this:


The computer will answer:


That’s how the ideal PROLOG works. Other versions differ. Marseilles PROLOG is similar to the ideal PROLOG. Turbo PROLOG omits the question mark, says “true” instead of “yes”, and says “false” instead of “no”. Edinburgh PROLOG puts the question mark at the beginning of the sentence instead of the end, like this:


Advanced questions What does Alice love? Does Alice love something? Ask this:


The computer will answer:



2 solutions

What does Tom love? Does Tom love something? Ask:


The computer will answer:




3 solutions

Who loves tennis? Ask:


The computer will answer:



2 solutions

Does anybody love hockey? Ask:


The computer doesn’t know of anybody who loves hockey, so the computer will answer:

no solution

Does Tom love something that Alice doesn’t? Ask:

loves(tom,X) and not (loves(alice,X))?

The computer will answer:


1 solution

That’s ideal PROLOG.

Turbo PROLOG is similar to ideal PROLOG. For Marseilles PROLOG, replace the word “and” by a blank space.

For Edinburgh PROLOG, replace the word “and” by a comma. After the computer finds a solution, type a semicolon, which tells the computer to find others; when the computer can’t find any more solutions, it says “no” (which means “no more solutions”) instead of printing a summary message such as “2 solutions”.

PROLOG’s popularity After being invented in France, PROLOG quickly became popular throughout Europe.

Its main competitor was LISP, which was invented in the United States before PROLOG. Long after PROLOG’s debut, Americans continued to use LISP and ignored PROLOG.

In the 1980’s, the Japanese launched the Fifth Generation Project, which was an attempt to develop a more intelligent kind of computer. To develop that computer’s software, the Japanese decided to use PROLOG instead of LISP, because PROLOG was non-American and therefore furthered the project’s purpose, which was to one-up the Americans.

When American researchers heard that the Japanese chose PROLOG as a software weapon, the Americans got scared and launched a counter-attack by learning PROLOG also.

When Borland — an American company — developed Turbo PROLOG, American researchers were thrilled, since Turbo PROLOG ran faster than any other PROLOG. It ran faster on a cheap IBM PC than Japan’s PROLOG ran on Japan’s expensive maxicomputers! The money that Japan had spent on maxicomputers was wasted! The Americans giggled with glee.

Moral: though the Japanese can beat us in making hardware, we’re still way ahead in software. But wouldn’t it be great if our countries could work together and share talents?