Read This! | Scheme | Picolisp | Operating Systems | AssemblyLanguage | Computer Security |
R6RS - Revision 6 Scheme Standard
The following are my notes on the standard, which I have pretty much lifted of the standard itself. The aim is to:- Reduce both the jargon and overall text size
- To clarify difficult issues or parts of the text which seem ambiguous
Notes
- First-class procedures (lambda calculus) prove the usefulness of static scope rules and block structure in a dynamically typed language.
- Scheme distinguishes
- procedures from lambda expressions and symbols,
- uses a single lexical environment for all variables and
- evaluates the operator position of a procedure call in the same way as an operand position.
- By relying entirely on procedure calls to express iteration, Scheme emphasizes the fact that tail-recursive procedure calls are essentially gotos that pass arguments.
- uses first-class escape procedures, from which all previously known sequential control structures can be synthesized.
- Has the concept of exact and inexact number objects, an extension of Common Lisp’s generic arithmetic.
- Supports hygienic macros, which permit the syntax of a block-structured language to be extended in a consistent and reliable manner.
1.0 Overview
- Scheme has latent as opposed to manifest types
- Types are associated with objects (also called values) rather than with variables.
- All objects created in the course of a Scheme computation, including procedures and continuations, have unlimited ex- tent. They Do not HAVE to be destroyed, although they often are for practical reasons
- Implementations of Scheme must be properly tail- recursive.
- In Scheme, the argument expressions of a procedure call are evaluated before the procedure gains control, whether the procedure needs the result of the evaluation or not.
- In Scheme objects are also referred to as values. Booleans
1.1 Types
#t is True #f is FalseNumbers
Characters & Strings
Characters are isomorphic to the scalar values of the Unicode standard. Symbols
A symbol is an object representing a string, the symbol’s name.
Pairs & Lists
A pair is a data structure with two components
Vectors
Vectors, like lists, are linear data structures representing finite sequences of arbitrary objects. Accessed by index.
Procedures
Procedures are values in Scheme.
1.2. Expressions
Expressions evaluate to values- Literal Expression
- #t --> #t
- 23 --> 23
- Compound Expression
- (+ 23 42) --> 65
- (+ 14 (* 23 42)) --> 980
1.3. Variables and binding
- Scheme allows identifiers to stand for locations containing values.
- These identifiers are called variables.
- local bindings can be made with let, for example:
(Let ((x 23)) x)) --> 23
1.4. Definitions
Make top level bindings with define, for example:-
(define x 23)
1.5. Forms
define is a form. It does not result in returning a value.1.6. Procedures
- A procedure is, slightly simplified, an abstraction of an expression over objects.
- A lambda expression creates a new procedure as
an object, with no need to specify a name:
((lambda (x) (+ x 42)) 23) --> 65
04dec16 | admin |