Skip to main content

1986 | Buch

Programming with Sets

An Introduction to SETL

verfasst von: J. T. Schwartz, R. B. K. Dewar, E. Schonberg, E. Dubinsky

Verlag: Springer US

Buchreihe : Monographs in Computer Science

insite
SUCHEN

Über dieses Buch

The programming language SETL is a relatively new member of the so-called "very-high-level" class of languages, some of whose other well-known mem­ bers are LISP, APL, SNOBOL, and PROLOG. These languages all aim to reduce the cost of programming, recognized today as a main obstacle to future progress in the computer field, by allowing direct manipulation of large composite objects, considerably more complex than the integers, strings, etc., available in such well-known mainstream languages as PASCAL, PL/I, ALGOL, and Ada. For this purpose, LISP introduces structured lists as data objects, APL introduces vectors and matrices, and SETL introduces the objects characteristic for it, namely general finite sets and maps. The direct availability of these abstract, composite objects, and of powerful mathematical operations upon them, improves programmer speed and pro­ ductivity significantly, and also enhances program clarity and readability. The classroom consequence is that students, freed of some of the burden of petty programming detail, can advance their knowledge of significant algorithms and of broader strategic issues in program development more rapidly than with more conventional programming languages.

Inhaltsverzeichnis

Frontmatter
Chapter 1. Programming Concepts
J. T. Schwartz, R. B. K. Dewar, E. Schonberg, E. Dubinsky
Chapter 2. Simple Data Types, Expressions, and Operations
Abstract
SETL allows one to manipulate two main kinds of data items, namely simple data items and composite data items. The intuitive distinction between these is that composite data items have elements, or components, which are themselves other (simple or composite) data items.
J. T. Schwartz, R. B. K. Dewar, E. Schonberg, E. Dubinsky
Chapter 3. Compound Data Types and Operators
Abstract
Sets in SETL are finite collections of arbitrary SETL values. These values, called the members (or elements) of the set, are themselves data items of any SETL type. To write a set denotation, we simply list the members of the set, with commas between successive members, within the set brackets “{” and “}”.
J. T. Schwartz, R. B. K. Dewar, E. Schonberg, E. Dubinsky
Chapter 4. Control Structures
Abstract
Execution of a SETL program proceeds sequentially, one statement being executed after the other. In the simplest case, the order of execution is simply the order in which the statements are written in the program.
J. T. Schwartz, R. B. K. Dewar, E. Schonberg, E. Dubinsky
Chapter 5. Procedures
Abstract
A procedure in SETL is a sequence of computational steps which have been given a name and which, using one or more data items passed to it for processing, will compute and deliver a value. Most of the built-in SETL operators, for example max, which returns the maximum of two values x and y, and cos, which returns the cosine of a floating-point number x passed to it, are procedures in this sense. However, since no finite collection will ever exhaust the whole catalog of procedures that a programmer may want to use, it is important to have a way of defining, and then using, as many additional operations as are helpful.
J. T. Schwartz, R. B. K. Dewar, E. Schonberg, E. Dubinsky
Chapter 6. Program Development, Testing, and Debugging
Abstract
The normal stages of a program’s life cycle are:
(i)
Initial conception, formulation of requirements,
 
(ii)
Overall design of a program that will meet these requirements.
 
(iii)
Detailed design and coding.
 
(iv)
Program review, with rework and extension as needed to clarify, simplify, or improve efficiency.
 
(v)
Development of a test plan, testing and debugging, removal of errors, and retest.
 
(vi)
Operational use of program.
 
(vii)
Enchancement and repair during continuing operational use.
 
(viii)
Retirement.
 
J. T. Schwartz, R. B. K. Dewar, E. Schonberg, E. Dubinsky
Chapter 7. Backtracking
Abstract
Backtracking or nondeterministic programming is an ingenious technique useful for solving a very common and important type of search problem. Such problems can be regarded as logical or combinatorial “mazes” which a program must explore in order to find a desired solution point. In favorable cases, one will be able to do this by devising an algorithm which proceeds in relatively direct fashion from an initial position to a solution, along a path involving little or no trial and error. However, some problems are too complex for such algorithms to be available, and it is for these problems that the method of backtracking is most useful. Characteristically, programs for solving these problems encounter situations in which a decision must be made as to which of several alternatives is to be explored next, but in which no clear grounds can be found for making one rather than another decision. A correct decision will lead on to a solution of the problem being explored, but an incorrect decision will wind up in a dead end, and the program will have to revert to the point at which it took its first wrong turning and try an alternative originally ignored. Finding paths through mazes and solving geometric and spatial puzzles like “instant insanity” are obvious examples of this kind of problem.
J. T. Schwartz, R. B. K. Dewar, E. Schonberg, E. Dubinsky
Chapter 8. Structuring Large SETL Programs
Abstract
In the present chapter we round out our account of the control structures of SETL by describing certain useful facilities not covered in earlier chapters.
J. T. Schwartz, R. B. K. Dewar, E. Schonberg, E. Dubinsky
Chapter 9. Input/Output and Communication with the Environment
Abstract
In this chapter, we cover various SETL capabilities that have been ignored in the preceding chapters. These include additional facilities for input/output, for sensing aspects of the environment in which a SETL program is running, and for passing strings or integers as parameters to SETL runs in a particularly convenient way. A full account of all the memory options and listing control commands which can be used to modify various aspects of SETL compilation and execution is given.
J. T. Schwartz, R. B. K. Dewar, E. Schonberg, E. Dubinsky
Chapter 10. The Data Representation Sublanguage
Abstract
The level of a programming language is determined by the power of the semantic primitives which it provides. The operations provided by the ordinary low-level languages, e.g., languages of the FORTRAN type, all lie close to those elementary operations with a few dozen bits of input and output which computer hardware implements directly. Languages of somewhat higher level, e.g., PL/I, PASCAL, or Ada, supplement these primitives with more advanced pointer-oriented memory management mechanisms and also support recursion; nevertheless, even these languages stay close to operations which can be translated into efficient machine code in relatively obvious ways. SETL aims more radically than any of these languages at simplification of the programmer’s task; for this reason it supports use of abstract objects (sets and maps) whose best machine-level representation is not obvious. Of course, many possible representations for objects of this kind are known, but which representation is best will vary from program to program in subtle ways that depend on the specific operations that a program applies to the objects that it manipulates. If the most effective representation of a program’s data objects is not chosen, efficiency will suffer, and it is this efficiency barrier that has prevented rapid and widespread adoption of very high level languages like SETL.
J. T. Schwartz, R. B. K. Dewar, E. Schonberg, E. Dubinsky
Chapter 11. The Language in Action: A Gallery of Programming Examples
Abstract
In this, our last chapter, we illustrate the use of SETL by giving a variety of programs which exhibit its features and can serve as useful models of style. Some of the smaller programs present significant algorithms; the larger examples show how more substantial programming problems and applications can be addressed.
J. T. Schwartz, R. B. K. Dewar, E. Schonberg, E. Dubinsky
Backmatter
Metadaten
Titel
Programming with Sets
verfasst von
J. T. Schwartz
R. B. K. Dewar
E. Schonberg
E. Dubinsky
Copyright-Jahr
1986
Verlag
Springer US
Electronic ISBN
978-1-4613-9575-1
Print ISBN
978-1-4613-9577-5
DOI
https://doi.org/10.1007/978-1-4613-9575-1