Scheme, Briefly


Scheme offers a simple model for computation. It avoids the "feature creep" of other programming languages, leaving only a few constructs required for an advanced language. Even the syntax is stripped bare of superfluous characters , leaving only pairs of parentheses to demarcate an expression. Simplicity does not imply, however, that Scheme is any less powerful than more popular languages. On the contrary, because Scheme provides only the essential primitives required of an advanced language, programmers are free to combine these primitives in ever more powerful ways. Scheme is an extremely versatile language suitable for any programming task.

Scheme provides a suite of primitive value types. Boolean, character, and string types are no surprise. A symbol type is a name , similar to an interned string. A port type represents input and output devices. A vector type is a fixed-size heterogeneous array of values. Drawing from its LISP heritage, a pair type is a two-element vector. A procedure type represents code without a name, commonly referred to as a closure.

In Scheme, the number type is more complicated. To remain independent of hardware limitations, numbers are expected to support values of nearly unbounded size and precision. Scheme ignores implementation details such as fixed and floating-point numbers ; instead, it is concerned with the exactness of a number ”whether a number is written exactly or is an approximation of a number. These distinctions and conversions between numbers are handled automatically.

In the ascetic spirit of Scheme, a procedure named call-with-current-continuation, or call/cc, can be used to implement all known sequential control structures. A signature feature of Scheme, a continuation is often described as "the rest of the computation." For example, given the expression "(3 + 4) * 5," when computing "3 + 4" the continuation at that point is a function that takes the result of the addition and sends it to "x * 5." Because continuations are first class, one could replace that continuation with another, causing execution to suddenly jump to another point in the program. Continuations can be used to implement complex escape routines, threading systems, generators, and more. Because they are so novel and powerful, special compiler and runtime support are used to implement continuations.

Scheme is a latently typed language. Because type checking is performed dynamically at runtime, it is commonly referred to as a dynamically typed language. All values have a fixed type, but the types are not statically declared; instead, the types are checked at runtime. The program will compile and execute until it attempts to perform an illegal operation on some type ”perhaps adding a character and number together. This offers greater power and flexibility, albeit without the extra safety of statically typed languages.



Programming in the .NET Environment
Programming in the .NET Environment
ISBN: 0201770180
EAN: 2147483647
Year: 2002
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net