The ABC Programmer's Handbook by Leo Geurts, Lambert Meertens, and Steven Pemberton

Write to screen; 

Read expression from terminal to address; expr is example of type to be read. 

Read line of text 

Put value of expr in address 

Start
random sequence for 

Remove one item from list 

Insert in right place 

Delete location or table entry 

Do nothing 

Execute userdefined command 

Execute refined command 

Check test and stop if it fails 
commands 
If test succeeds, execute commands;
no 

Select one alternative: 

try each test in order 

(one must succeed; 

the
last test may be 

As long as test succeeds, execute commands 

Take each item of train in turn 

Defines new command KEYWORD . . . 

Defines new function f with no arguments (returns a value) 

Defines new function f with one argument 

Defines new function f with two arguments 

Defines new predicate pr with no arguments (succeeds/fails) 

Defines new predicate pr with one argument 

Defines new predicate pr with two arguments 

(Before commands of howto) share names 
KEYWORD 
Defines commandrefinement 
name 
Defines expression or testrefinement 

Leave commandhowto or commandrefinement, or leave ABC 

Leave functionhowto or expressionrefinement, return value of expr 

Leave predicatehowto or testrefinement, report outcome of test 

The same, report success 

The same, report failure 

Exact constants 
expr 
Compound 
name 
Naming (may also be used as address) 
text


text


text


table 
Table selection (also address) 

Textual displays (empty: 

Conversion of expr to text 

List
display (empty: 

List of consecutive values 

Table
display (empty: 
f, f x, x f y 
Result of function f (no permanent effects) 
name 
Result of refinement (no permanent effects) 
x 
Order tests 
x 
( 


pr, pr x, x pr y 
Outcome of predicate pr (no permanent effects) 
name 
Outcome of refinement (no permanent effects) 
test

Fails as soon as one of the tests fails 
test

Succeeds as soon as one of the tests succeeds 



Sets name, . . . on success 

Sets name, . . . on failure 

Sets name, . . . on failure 

Approximate value of x 

Exact value of x 

Test if x is exact 

Plain arithmetic 
x 
x raised to the power y 

Square root, nth root 

Absolute value, sign (= 1, 0, or +1) 

Rounded to whole number 
n 
x rounded to n digits after decimal point 
a 
Remainder of a on division by n 

Numerator of exact number x 

Denominator 

Random approximate number r, 0 £ r < 1 

Base of natural logarithms, exponential function 

Natural logarithm, logarithm to the base b 

Trigonometric functions, with x in radians 

Angle of and radius to point (x, y) 
c 
Similar, with the circle divided into c parts 
c 
(e.g. 360 for degrees) 
t 
t and u joined into one text 
t 
t repeated n times 





t with leading and trailing spaces removed 

t split into words 

List of all keys in table 

Number of items in train 
e 
Number of items equal to e 
e 
Test for presence or absence 

Smallest item of train 
e 
Smallest item larger than e 

Largest item 
train

nth item 

Random item 
x 
x converted to text, aligned left in width n 
x 
Similar but centred 
x 
Similar but aligned right 

This is the order of all characters that may occur in a text. (The first is a space.) 
The ABC Programmer's Handbook by Leo Geurts, Lambert Meertens, and Steven Pemberton
Copyright © 1990, 2002, Leo Geurts, Lambert Meertens, and Steven Pemberton. All rights reserved.