Revised3report on the Algorithmic Language Scheme
Total Page:16
File Type:pdf, Size:1020Kb
Revised Rep ort on the Algorithmic Language Scheme JONATHAN REES AND WILLIAM CLINGER Editors H ABELSON R K DYBVIG C T HAYNES G J ROZAS N I ADAMS IV D P FRIEDMAN E KOHLBECKER G J SUSSMAN D H BARTLEY R HALSTEAD D OXLEY M WAND G BROOKS C HANSON K M PITMAN Dedicated to the Memory of ALGOL CONTENTS SUMMARY Introduction The rep ort gives a dening description of the program Overview of Scheme ming language Scheme Scheme is a statically scop ed and Semantics prop erly tailrecursive dialect of the Lisp programming Syntax language invented by Guy Lewis Steele Jr and Gerald Notation and terminology Jay Sussman It was designed to have an exceptionally Lexical conventions clear and simple semantics and few dierent ways to form Identiers expressions A wide variety of programming paradigms in Whitespace and comments cluding imp erative functional and message passing styles Other notations nd convenient expression in Scheme Basic concepts The introduction oers a brief history of the language and Variables and regions of the rep ort True and false External representations The rst three chapters present the fundamental ideas of Expressions the language and describ e the notational conventions used Primitive expression types for describing the language and for writing programs in the Derived expression types language Program structure Chapters and describ e the syntax and semantics of Programs expressions programs and denitions Denitions Standard pro cedures Chapter describ es Schemes builtin pro cedures which Bo oleans include all of the languages data manipulation and in Equivalence predicates putoutput primitives Pairs and lists Chapter provides a formal syntax for Scheme written in Symbols extended BNF along with a formal denotational semantics Numbers The rep ort concludes with an example of the use of the Characters language and an alphab etic index Strings Vectors Control features Input and output Formal syntax and semantics Formal syntax Formal semantics Derived expression types Notes Example Bibliography and references Alphab etic index of denitions of concepts keywords and pro cedures Revised Scheme INTRODUCTION Programming languages should b e designed not by piling agenda for the workshop but was unable to attend the ses feature on top of feature but by removing the weaknesses sions and restrictions that make additional features app ear nec Subsequent electronic mail discussions and committee work essary Scheme demonstrates that a very small number of completed the denition of the language Gerry Sussman rules for forming expressions with no restrictions on how drafted the section on numbers Chris Hanson drafted the they are comp osed suce to form a practical and ecient sections on characters and strings and Gary Bro oks and programming language that is exible enough to supp ort William Clinger drafted the sections on input and output most of the ma jor programming paradigms in use to day William Clinger recorded the decisions of the workshop and compiled the pieces into a coherent do cument The Re Scheme has inuenced the evolution of Lisp Scheme was vised revised rep ort on Scheme was published at MIT one of the rst programming languages to incorp orate rst and Indiana University in the summer of Another class pro cedures as in the lambda calculus thereby proving round of revision in the spring of again accomplished the usefulness of static scop e rules and blo ck structure in almost entirely by electronic mail resulted in the present a dynamically typed language Scheme was the rst ma jor rep ort dialect of Lisp to distinguish pro cedures from lambda ex pressions and symbols to use a single lexical environment We intend this rep ort to b elong to the entire Scheme com for all variables and to evaluate the op erator p osition of munity and so we grant p ermission to copy it in whole or in a pro cedure call in the same way as an op erand p osition part without fee In particular we encourage implementors By relying entirely on pro cedure calls to express iteration of Scheme to use this rep ort as a starting p oint for manuals Scheme emphasized the fact that tailrecursive pro cedure and other do cumentation mo difying it as necessary calls are essentially gotos that pass arguments Scheme was the rst widely used programming language to em Acknowledgements brace rst class escap e pro cedures from which all known sequential control structures can b e synthesized A few We would like to thank the following p eople for their of these innovations have recently b een incorp orated into comments and criticisms Alan Bawden George Carrette Common Lisp while others remain to b e adopted Andy Cromarty Andy Freeman Richard Gabriel Yekta Gursel Ken Haase Paul Hudak Richard Kelsey Chris Lindblad Mark Meyer Jim Miller Jim Philbin John Background Ramsdell Guy Lewis Steele Jr Julie Sussman Perry Wa The rst description of Scheme was written in A gle Daniel Weise and Henry Wu We thank Carol Fes revised rep ort app eared in which describ ed the senden Daniel Friedman and Christopher Haynes for p er evolution of the language as its MIT implementation was mission to use text from the Scheme version reference upgraded to supp ort an innovative compiler Three manual We thank Texas Instruments Inc for p ermission distinct pro jects b egan in and to use variants to use text from the TI Scheme Language Reference Man of Scheme for courses at MIT Yale and Indiana Univer ual We gladly acknowledge the inuence of manuals for sity An introductory computer science text MIT Scheme T Scheme Common Lisp and Algol b o ok using Scheme was published in We also thank Betty Dexter for the extreme eort she put As might b e exp ected of a language used primarily for ed into setting this rep ort in T X and Donald Knuth for de E ucation and research Scheme has always evolved rapidly signing the program that caused her troubles This was no problem when Scheme was used only within The Articial Intelligence Lab oratory of the Massachusetts MIT but as Scheme b ecame more widespread lo cal di Institute of Technology and the Computer Science Depart alects b egan to diverge until students and researchers o c ment of Indiana University supp orted the preparation of casionally found it dicult to understand co de written at this rep ort Supp ort for the MIT work was provided in other sites part by the Advanced Research Pro jects Agency of the Fifteen representatives of the ma jor implementations of Department of Defense under Oce of Naval Research con Scheme therefore met in Octob er to work toward tract NC Supp ort for the Indiana Univer a b etter and more widely accepted standard for Scheme sity work was provided by NSF grants NCS and Participating in this workshop were Hal Ab elson Nor NCS man Adams David Bartley Gary Bro oks William Clinger Daniel Friedman Rob ert Halstead Chris Hanson Christo pher Haynes Eugene Kohlb ecker Don Oxley Jonathan Rees Guillermo Rozas Gerald Jay Sussman and Mitchell Wand Kent Pitman made valuable contributions to the Overview of Scheme DESCRIPTION OF THE LANGUAGE Overview of Scheme ML C and APL are three other languages that always pass arguments by value This is distinct from the lazy evaluation semantics of SASL or the callbyname seman Semantics tics of Algol where an argument expression is not eval This section gives an overview of Schemes semantics A uated unless its value is needed by the pro cedure detailed informal semantics is the sub ject of chapters through For reference purp oses section provides a Syntax formal semantics of Scheme Scheme employs a parenthesizedlist Polish notation to de Following Algol Scheme is a statically scop ed program scrib e programs and other data The syntax of Scheme ming language Each use of a variable is asso ciated with a like that of most Lisp dialects provides for great expressive lexically apparent binding of that variable p ower largely due to its simplicity An imp ortant conse Scheme has latent as opp osed to manifest types Types quence of this simplicity is the susceptibility of Scheme are asso ciated with values also called ob jects rather than programs and data to uniform treatment by other Scheme with variables Some authors refer to languages with programs As with other Lisp dialects the read primitive latent types as weakly typed or dynamically typed lan parses its input that is it p erforms syntactic as well as guages Other languages with latent types are APL lexical decomp osition of what it reads Snob ol and other dialects of Lisp Languages with mani fest types sometimes referred to as strongly typed or stat ically typed languages include Algol Pascal and C Notation and terminology All ob jects created in the course of a Scheme computation Essential and nonessential features including pro cedures and continuations have unlimited ex It is required that every implementation