Skip Navigation

The Computer Journal 1988 31(3):220-228; doi:10.1093/comjnl/31.3.220
© 1988 by British Computer Society
This Article
Right arrow Full Text (PDF)
Right arrow Alert me when this article is cited
Right arrow Alert me if a correction is posted
Services
Right arrow Email this article to a friend
Right arrow Similar articles in this journal
Right arrow Similar articles in ISI Web of Science
Right arrow Alert me to new issues of the journal
Right arrow Add to My Personal Archive
Right arrow Download to citation manager
Right arrow Search for citing articles in:
ISI Web of Science (1)
Right arrowRequest Permissions
Google Scholar
Right arrow Articles by Griswold, R. E.
Right arrow Search for Related Content
Social Bookmarking
 Add to CiteULike   Add to Connotea   Add to Del.icio.us  
What's this?

Programming with Generators

R. E. Griswold *

Department of Computer Science, The University of Arizona, Tucson, Arizona 85721, USA

The facilities that a programming language provides effectively both specify and limit how programs in the language can be written. Programming languages with unusual facilities often lead to program formulations that would be difficult or unnatural in other programming languages. This paper describes the characteristics and use of such a facility: expressions that are capable of producing a sequence of results, not just a single result. Such expressions are called generators. Generators are described here in the context of the Icon programming language, in which they are a general feature, instead of being confined to specific data structures or particular contexts as they are in other programming languages.

In Icon, generators arise naturally from computations in which there is more than one possible solution. Coupled with goal-directed evaluation, this leads to concise and natural formulations of many types of computation. In turn, control structures are needed for generators that have no counterpart in more conventional programming languages.

Numerous examples of generators are given, together with some general paradigms for their use. From a more formal point of view, the capability of generators to produce results is characterized in terms of result sequences. Finally, the relationship between generators and logic programming is mentioned.


Received February 1986. revised November 1986.

* Department of Computer Science, The University of Arizona, Tucson, Arizona 85721, USA


Add to CiteULike CiteULike   Add to Connotea Connotea   Add to Del.icio.us Del.icio.us    What's this?




Disclaimer:
Please note that abstracts for content published before 1996 were created through digital scanning and may therefore not exactly replicate the text of the original print issues. All efforts have been made to ensure accuracy, but the Publisher will not be held responsible for any remaining inaccuracies. If you require any further clarification, please contact our Customer Services Department.