Charts

Youíve already learned the most popular computer languages: BASIC, DBASE, PASCAL, C, LOGO, FORTRAN, and COBOL.

But those seven languages are just the tip of the iceberg. Programmers have invented thousands of others.

Hereís a multilingual dictionary that lets you translate 15 languages. For example, it shows that BASIC says "DIM x(4)" but FORTRAN says "DIMENSION X(4)" instead.

+───────┬───────────────────────────────────────────────────────────────────────────────────────────────────┐

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

│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 │

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

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

│COBOL │X OCCURS 4 TIMES PERFORM SAM VARYING I FROM 5 BY 1 UNTIL I > 17 PERFORM FRED GO TO GAIL │

│ │ │

│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 │

└───────┴───────────────────────────────────────────────────────────────────────────────────────────────────┘

┌───────┬───────────────────────────────────────────────────────────────────────────────────────────────────┐

│BASIC │IF x = 4.3 THEN INPUT k 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 */ │

│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 four 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 four languages translate "IF x = 4.3 THEN" and "j = k + 2". Theyíre called radical languages; the other eleven languages are called mainstream.

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

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

BASIC LOGO EASY DBASE APL LISP FORTH SNOBOL ALGOL PASCAL ADA x

PRINT 2 + 2 PRINT 2+2 SAY 2+2 ? 2+2 2+2 (PLUS 2 2) 2 2 + . OUTPUT = 2 + 2 BEGIN BEGIN PROCEDURE HARRY IS

END PRINT(2+2); WRITELN(2+2); BEGIN

END END. PUT(2+2);

END;

FORTRAN PILOT C PL/I MODULA COBOL x

N=2+2 C:#N=2+2 main(){ HARRY: PROCEDURE OPTIONS(MAIN); MODULE HARRY; IDENTIFICATION DIVISION.

PRINT *, N T:#N printf("%d",2+2); PUT LIST(2+2); FROM INOUT DATA DIVISION.

END } END; IMPORT WRITEINTEGER; WORKING-STORAGE SECTION.

BEGIN 01 N PIC 9.

WRITEINTEGER(2+2,6); 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 17 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.

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 programíng Switzerland 1975 MODULA-2, OBERON

C C systems programíng Bell Telephone Labs 1970-1977 Visual C++, Turbo C++

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

DBASE Data BASE database manageínt Jet Propín Lab & Ashton-T. 1978-1980 Visual DBASE 5.5, Visual FOXPRO 3

EASY EASY general Secret Guide 1972-1982 EASY

Radical languages

LISP LISt Processing artificial intelligence MIT 1958-1960 Common LISP

SNOBOL StriNg-Oriented symBOlic Language string processing Bell Telephone 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 LCSI LOGO, LOGO Writer

FORTH FOuRTH-generation language busin. & 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 5

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

Of those 23 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), 2 at Stanford University (FORTH and SPSS), 2 by Professor Niklaus Wirth in Switzerland (PASCAL and MODULA), and 2 at Bell Telephone Labs (C and SNOBOL). The others were invented by geniuses elsewhere.

Mainstream languages

The first mainstream languages were FORTRAN, ALGOL, and COBOL. FORTRAN appealed to engineers, ALGOL to logicians, and COBOL to business executives. FORTRAN was invented by IBM, ALGOL by an international committee, and COBOL by a committee based at the Pentagon.

The other mainstream languages, which came later, were just slight improvements of FORTRAN, ALGOL, and COBOL.

For example, 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.

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.

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; 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 Telephone 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.

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. Of all the new mainstream languages (C, ADA, DBASE, and EASY), DBASE has become the greatest commercial success, and Wayne has become rich.

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.Ö

FORTRAN

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.

How FORTRAN developed 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. Instead of using apostrophes and writing ĎPLEASE KISS MEí, the programmers had to write 14HPLEASE KISS ME; the 14H meant a 14-character string.

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, college kids are required to study PASCAL, professional programmers 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. For example, 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.

ALGOL

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 arenít on most keyboards. 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 today, 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).

COBOL

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, and so a follow-up meeting was 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 236"); 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 be 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.

BASIC

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 mathematics. 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.

How BASIC compares with ALGOL and 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".

Why BASIC overshadows 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 second version of BASIC (October 1964) added the semicolon.

The third 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 fourth 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 fifth version (1970) added data files (sequential access and random access).

The sixth 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 and 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 via telephone.

General Electric, which built Dartmouthís computer, quit making computers and sold its computer factory to Honeywell. So today, 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.

Hewlett-Packard Soon after DEC started putting BASIC on its computers, Hewlett-Packard decided to do likewise: Hewlett-Packard put BASIC on the HP-2000 computer, and then put a better version of BASIC on the HP-300 computer.

Unfortunately, Hewlett-Packardí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, which is available only 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 and variations 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:

SAY TRANSLATE$("I LOVE YOU")

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:

IF AGE<18 THEN

PRINT "YOU ARE STILL A MINOR."

PRINT "AH, THE JOYS OF YOUTH!"

PRINT "I WISH I COULD BE AS YOUNG AS YOU!"

END IF

By using the SUB command, you can give a subroutine a name, like this:

PRINT "WE ALL KNOW..."

CALL INSULT

PRINT "...AND YET WE LOVE YOU"

SUB INSULT STATIC

PRINT "YOU ARE STUPID"

PRINT "YOU ARE UGLY"

END SUB

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 has stopped marketing Turbo BASIC, so that Borland can devote its energies to other Borland products that are more profitable (such as Turbo PASCAL, Turbo C, Quattro, and Paradox).

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:

10 INPUT "WHAT IS YOUR NAME"; A$

In ANSI BASIC, you say this instead:

10 INPUT PROMPT "WHAT IS YOUR NAME? ": A$

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 today:

┌───────┬───────┬───────┐

│ Video │ Audio │ Logic │

├───────┼───────┼───────┤

│ │ │ │

│ │ │ │

│ │ │ │

│ │ │ │

┌──────────────────────────────────────────────────────┼───────┼───────┼───────┤

│IBM PC color with Visual BASIC 2 or 3 or QBASIC │ √ √ √ │ √ √ │ √ √ √ │

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

├──────────────────────────────────────────────────────┼───────┼───────┼───────┤

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

├──────────────────────────────────────────────────────┼───────┼───────┼───────┤

│IBM PC color GW BASIC, Commodore 128, or TRS-80 Color │ √ √ √ │ √ √ │ √ │

├──────────────────────────────────────────────────────┼───────┼───────┼───────┤

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

├──────────────────────────────────────────────────────┼───────┼───────┼───────┤

│IBM PC monochrome with GW BASIC │ √ │ √ √ │ √ │

│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 (Amiga BASIC, Visual BASIC, and QBASIC) are the best: they understand 8 of the 9 words. The versions of BASIC at the bottom of the chart (Commodore 64 BASIC & Vic-20 BASIC) are the worst: they understand none of the words.

Hereís what those 9 words accomplish:

The word USING (which you put immediately after the word PRINT) 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 are cheap, the chart shows their versions of BASIC are better than the Apple 2cís. If schools would have bought Commodore 128 and Radio Shack TRS-80 Color Computers instead of Apple 2cís, students would be better programmers!

PL/I

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 two 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.

from FORTRAN: FORMAT, STOP, CALL, RETURN, DO

from ALGOL: IF, GO, PROCEDURE, BEGIN, END

from COBOL: OPEN, CLOSE, READ, WRITE, DISPLAY, EXIT

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).

PASCAL

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 very 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íve been writing large FORTRAN programs for large computers are switching to PASCAL, because PASCAL helps organize large programs better, and because FORTRAN is archaic. Many programmers whoíve been using PL/I are switching to PASCAL, because PASCAL consumes less RAM than PL/I and fits in smaller computers.

Most colleges require freshman computer-science majors to take PASCAL.

Most high-school seniors applying to attend college take tests given by the College Entrance Examination Board. The most famous such test is the Scholastic Aptitude Test (SAT), but the board offers many others. One of the boardís newest tests is the Advanced Placement Test in Computer Science; a high-school senior who scores high on that test can skip the first year of college computer-science courses and go immediately into college-sophomore courses. Since that test requires a knowledge of PASCAL, many high-school seniors are studying PASCAL.

Best versions The most powerful PASCAL for microcomputers is Turbo PASCAL, published by Borland. Itís available for the IBM PC, Mac, and CP/M computers.

If you have a Mac, get either the Mac version of Turbo PASCAL or Think PASCAL. If you have an Apple 2e or 2c, get Instant PASCAL (which is much easier to use than the UCSD PASCAL that was sold under the name "Apple PASCAL").

MODULA

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");

WRITELN('YOU ARE STILL A MINOR'); WRITESTRING("AH, THE JOYS OF YOUTH");

WRITELN('AH, THE JOYS OF YOUTH'); ELSE

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

ELSE WRITESTRING("WE CAN HAVE ADULT FUN")

BEGIN END;

WRITELN('GLAD YOU ARE AN ADULT');

WRITELN('WE CAN HAVE ADULT FUN');

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.

C

Many programmers are starting to 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 1972, his colleague Dennis Ritchie added a few commands to B, to form a more extensive language. Since that language came after B, it was called C.

So C 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.

Bell Labs invented an operating system called Unix. The original version of Unix was created by using B. The newest versions of Unix were created by using C instead, which is more powerful.

Cís peculiarities Like B, C is a tiny language. It 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 input and output (such as printf and 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 theyíre all 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.

C++ Now most C programmers use an improved C, called C++.

ADA

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 under contract to the U.S. Department of Defense.

Popularity Will ADA become popular? Wait and see.

Many researchers are trying to make computers understand ADA. So far, the results are incomplete: you can buy disks containing parts of ADA, but the full version isnít on disk yet.

When full versions of ADA become available and programmers try using them, weíll know whether the language is a pleasure or a pain.

DBASE

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.

Advertisement 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.

Unfortunately, the menus of DBASE 3 PLUS are hard to learn how to use. Also, the menus are incomplete: they donít let you tap the full power of DBASE 3 PLUS. So to use DBASE 3 PLUS well, you must learn how to program anyway.

In 1988, Ashton-Tate began shipping DBASE 4, which includes extra programming commands. Some of those 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. Discount dealers sell it for $529.

Dramatic improvements to DBASE have been created by other companies, who make clones of DBASE that outshine DBASE itself! The most popular clone is FOXPRO 2.6, which runs faster than DBASE, includes extra commands, and is marketed by Microsoft. Discount dealers have been selling it for just $94, but that temporary low price will probably rise.

EASY

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 twelve keywords:

SAY & GET

LET

REPEAT & SKIP

HERE

IF & PICK

LOOP

PREPARE & DATA

HOW

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:

4

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

SAY "LOVE"

SAY "HATE"

the computer will say:

LOVE HATE

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:

SAY TO SCREEN PRINTER HARRY

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:

LET R=4

To let R be a random decimal, type:

LET R=RANDOM

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

LET R=RANDOM TO 6

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

LET R=RANDOM FROM -3 TO 5

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:

HERE IS FRED

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:

IF SCORE=100

SAY "PERFECT"

IF SCORE<100 AND SCORE>=70

SAY SCORE

SAY "OKAY THOUGH NOT PERFECT"

IF SCORE<70

SAY "YOU FAILED"

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

IF SCORE=100

SAY "PERFECT"

IF NOT BUT SCORE>=70

SAY SCORE

SAY "OKAY THOUGH NOT PERFECT"

IF NOT

SAY "YOU FAILED"

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:

PICK SCORE

IF 100

SAY "PERFECT"

IF >=70

SAY SCORE

SAY "OKAY THOUGH NOT PERFECT"

IF NOT

SAY "YOU FAILED"

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:

LOOP

SAY "CAT"

SAY "DOG"

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

LOOP I FROM 5 BY 3 TO 17

SAY I

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:

LOOP I FROM 17 DOWN BY 3 TO 5

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:

PREPARE X(100)

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

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

LET X=NEXT

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

PRETEND YOU ARE HUMAN

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

HOW TO PRETEND YOU ARE HUMAN

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 ó

LET X=4

LET Y=7

you can say:

LET X=4, Y=7

Instead of saying ó

PRETEND YOU ARE HUMAN

PRETEND GOD IS DEAD

you can say:

PRETEND YOU ARE HUMAN, GOD IS DEAD

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

Radicals

Letís examine the radical languages, beginning with the oldest radical ó the oldest hippie ó LISP.

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:

BASIC LISP

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 older 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:

7

If you type ó

(PLUS 1 3 1 1)

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

6

If you type ó

(DIFFERENCE 7 (TIMES 2 3))

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

1

If you type ó

'LOVE

the computer will print:

LOVE

Notice that 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:

'(LAUGH LOUDLY)

That makes the computer print:

(LAUGH LOUDLY)

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:

(CAR '(SAILORS DRINK WHISKEY))

The computer will print:

SAILORS

If you type ó

(CDR '(SAILORS DRINK WHISKEY))

the computer will print:

(DRINK WHISKEY)

If you type ó

(CAR (CDR '(SAILORS DRINK WHISKEY)))

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:

DRINK

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:

(CONS 'MANY '(SAILORS DRINK WHISKEY))

The computer will print:

(MANY SAILORS DRINK WHISKEY)

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:

(SETQ Y 'LOVE)

Then if you say ó

Y

the computer will say:

LOVE

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

(SETQ STOOGES '(MOE LARRY CURLEY))

Then if you say ó

STOOGES

the computer will say:

(MOE LARRY CURLEY)

To find the first of the STOOGES, say:

(CAR STOOGES)

The computer will say:

MOE

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

(DEFUN DOUBLE (X)

(TIMES 2 X)

)

Then if you say ó

(DOUBLE 3)

the computer will print:

6

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 (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:

(DEFUN REPEAT (X N)

(COND

((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 ó

(REPEAT 'LOVE 5)

the computer will print:

(LOVE LOVE LOVE LOVE LOVE)

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:

(DEFUN ITEM (N X)

(COND

((ONEP N) (CAR X))

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

)

)

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

SNOBOL

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

C = "BODY TEMPERATURE IS 9" B

OUTPUT = "MY " C

END

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:

BODY TEMPERATURE IS 98.6

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:

NUMBER.OF.BULLIES.I.SQUIRTED

Looping This programís a loop:

FRED OUTPUT = "CAT"

OUTPUT = "DOG" :(FRED)

END

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

CAT

The next line makes the computer print ó

DOG

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

CAT

DOG

CAT

DOG

CAT

DOG

etc.

Replacing SNOBOL lets you easily replace one phrase by another.

X = "SIN ON A PIN WITH A DIN"

X "IN" = "UCK"

OUTPUT = X

END

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:

SUCK ON A PIN WITH A DIN

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

END

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

END

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:

SUCK ON A PUCK WITH A DUCK

Deleting This program deletes the first "IN":

X = "SIN ON A PIN WITH A DIN"

X "IN" =

OUTPUT = X

END

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

END

The computer will print:

S ON A P WITH A D

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

LOOP X "IN" = :F(ENDING)

COUNT = COUNT + 1 :(LOOP)

ENDING OUTPUT = COUNT

END

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:

3

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.

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

APL

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:

8+9

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:

17

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 *B e raised to the Bth power, where e is 2.718281828459045

LOG A*B logarithm, base A, of B

natural log *B logarithm, base e, of B

CEILING é B B rounded up to an integer

maximum Aé B A or B, whichever is larger

FLOOR Aë B B rounded down to an integer

minimum ë 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 oB p times B

circular AoB sin B if A=1 arcsin B if A=-1 square root of 1+B2 if A= 4

cos B if A=2 arccos B if A=-2 square root of 1-B2 if A= 0

tan B if A=3 arctan B if A=-3 square root of B2-1 if A=-4

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

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 A B 1 if A or B is 1; otherwise 0

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

NOT ~B 1 if B is 0; otherwise 0

To make the symbol *, 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 ó

2◊3+5

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

16

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

If you type ó

9-4-3

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:

8

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:

X 3

X+2

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

5

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:

Y 5 2 8

Y+1

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:

A 5 2.1 6

B 3 2.8 -7

A+B

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:

A 5 2.1 6

B 3 2.8 -7

C A+B

C

Hereís something different:

X 4 2 3

+/X

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

Y

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 |V 6 5 8 reverse V

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

GENERATE 3 1 2 3 count up to 3

index of V 5 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 |V 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 10 V 856 8, times 10, plus 5, times 10, plus 6

encode 10 856 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

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.

Today, 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 is becoming 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.

Recently, Terrapin has had financial difficulties and moved to Maine.

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 ó

A=B+C

but in LOGO you must type:

MAKE "A :B+:C

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.

FORTH

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

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

20 PRINT "I AM A COMPUTER"

30 INPUT "DO YOU LIKE COMPUTERS";A$

40 IF A$="YES" OR A$="YEAH" OR A$="YEP" OR A$="SURE" OR A$="SURELY" OR A$="I SUR

E DO" THEN PRINT "I LIKE YOU TOO" ELSE PRINT "TOUGH LUCK"

PILOT program What the computer will do

T:I AM A COMPUTER Type "I AM A COMPUTER".

T:DO YOU LIKE COMPUTERS? Type "DO YOU LIKE COMPUTERS?"

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.

Specialists

For specialized applications, use a special language.

APT

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

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:

P.K=P.J+DT*(BR.JK-DR.JK)

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:

* WORLD DYNAMICS

L P.K=P.J+DT*(BR.JK-DR.JK)

N P=PI

C PI=1.65E9

R BR.KL=P.K*FIFGE(BRN,BRN1,SWT1,TIME.K)*BRFM.K*BRMM.K*BRCM.K*BRPM.K

etc.

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 The first version of DYNAMO was invented in 1959 by Phyllis Fox and Alexander Pugh III. It was an improvement on a language called SIMPLE, which had been invented the year before by Richard Bennett at MIT. "SIMPLE" stood for "Simulation of Industrial Management Problems with Lots of Equations".

In 1961 at MIT, 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.

GPSS

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:

SIMULATE

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.

END

Indent so that the word SIMULATE begins in column 8 (preceeded 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

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 have a file called MANHOURS, containing one punched card per employee:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

On each card, column 1-5 contain the employeeís identification number, columns 6-20 contain his name, and columns 21-23 tell how many hours he worked. Letís make an IBM System/3 minicomputer print the whole file on the line printer, with extra spacing, and also print the total number of man-hours in the company, like this:

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 columns. 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, columns 1-5 contain MANNO, columns 6-20 contain NAME, and columns 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.

Line 03 says to print NAME so it ends in column 23. Since the second form said NAME requires 15 columns, 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

0201 IMANHOURSAA 01

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.

SPSS

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:

RF

If a person said "Democrat Male", youíd feed the computer this line:

DM

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.

RF

DM

RM

RM

DF the "data cards"

DM

DF

DF

RM

DF

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:

ROW

R D TOTAL

┌─────┬─────┐

M │ 3 │ 2 │ 5

│60.0%│40.0%│ 50.0%

│75.0%│33.3%│

│30.0%│20.0%│

├─────┼─────┤

F │ 1 │ 4 │ 5

│20.0%│80.0%│ 50.0%

│25.0%│66.7%│

│10.0%│40.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, insert this statement underneath the CROSSTABS statement:

OPTIONS 3,5

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

1. chi-square, its degrees of freedom, and its 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:

STATISTICS 1,8

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

STATISTICS ALL

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

AGGREGATE ANOVA BREAKDOWN CANCORR CONDESCRIPTIVE DISCRIMINANT

FACTOR FREQUENCIES GUTTMAN SCALE NONPAR CORR ONEWAY PARTIAL CORR

PEARSON CORR REGRESSION SCATTERGRAM T-TEST WRITE CASES

Each procedure has its own OPTIONS and STATISTICS.

SPSS includes many other kinds of statements:

ADD CASES ADD DATA LIST ADD SUBFILES ADD VARIABLES ALLOCATE ASSIGN MISSING

COMMENT COMPUTE COUNT DATA LIST DELETE SUBFILES DELETE VARS DO REPEAT

DOCUMENT EDIT END REPEAT FILE NAME GET ARCHIVE GET FILE IF KEEP VARS

LIST ARCHINFO LIST CASES LIST FILEINFO MERGE FILES MISSING VALUES NUMBERED

PAGESIZE PRINT BACK RAW OUTPUT UNIT READ MATRIX RECODE REORDER VARS

RUN NAME RUN SUBFILES SAMPLE SAVE ARCHIVE SAVE FILE SELECT IF SORT CASES

SUBFILE LIST TASK NAME VALUE LABELS WEIGHT WRITE FILEINFO

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.

PROLOG

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(alice,tennis).

loves(alice,sailing).

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

loves(tom,football).

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(alice,tennis)->;

loves(alice,sailing)->;

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

loves(tom,football)->;

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:

domains

person,sport=symbol

predicates

loves(person,sport)

clauses

loves(alice,tennis).

loves(alice,sailing).

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

loves(tom,football).

(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:

loves(alice,tennis)?

The computer will answer:

yes

Does Alice love football? Ask this:

loves(alice,football)?

The computer will answer:

no

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:

?-loves(alice,tennis).

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

loves(alice,X)?

The computer will answer:

X=tennis

X=sailing

2 solutions

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

loves(tom,X)?

The computer will answer:

X=tennis

X=sailing

X=football

3 solutions

Who loves tennis? Ask:

loves(X,tennis)?

The computer will answer:

X=alice

X=tom

2 solutions

Does anybody love hockey? Ask:

loves(X,hockey)?

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:

X=football

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 decided to launch 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 that had ever been invented. 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?