Scheme
Scheme has been inspired to be as minimal and semantically clear as humanly
possible. In part it was a reaction to the mess and a kitchen sink syndrome of
Common Lisp
(which incorporates nearly 30 years of the Lisp
tradition). It was
also heavily influenced by the results of Alonzo Church and Haskell Curry, on
the foundation of mathematics and the Lambda Calculus.
By the time of publication of the R5RS “standard”, everything has been “solved” and “done riight”. The unique masterpiece emerged.
In the late 90s, the “discovery” of the “Curry-Howard isomorphism” independently showed that this was the right (and the only) direction. Here I will try my best to explain why this is so in another post.
Scheme is also proved by example that a language should be a small set of well-chosen orthogonal (does not step on its own feet) but complementing each other features. A proper uniformity (everything is an expression) is what enables complementary features (universal nesting, high-order procedures, etc).
MIT Scheme
The MIT Scheme is not just a particular implementation of the Scheme language, it is an actual embodiment (or actual manifestation) of the whole Classic MIT Tradition, which is a distinct, unique cultural phenomena - a mix of mathematics, biology, linguistics, electrical engineering, artificial intelligence and computer science, with the corresponding major labs and faculties.
While Scheme itself was a programming language done right, The MIT Scheme is an
implementation done right. It has a fast and clean runtime written in portable
C
, a native code compiler, which supports a couple of major platforms, a
polished and principle-guided standard library, and bindings for most common
libraries, including X11, PostgreSQL and what not. It has an object system as an
embedded DSL, similar to CLOS.
Back then MIT Scheme was in itself a lesson in a proper, principle-guided software design and implementation. Nowadays it is a monument (on par with Erlang/OTP, SML/NJ, GHC or Ocaml 4).
All you need is Lambda
let
special form as a lambda with an in-place invocation. Again, a closure is an
implicit nested frame of an environment (for all its bindings).
((lambda (x) (+ 1 x)) 2)
which is semantically equivalent (the same function, a different form) to
(let ((x 2)) (+ 1 x))
Curried '+
with an in-place invocation
(((lambda (x) (lambda (y) (+ x y))) 2) 3)
Just right
When you have the right understanding, you inevitably do the right thing.
Scheme is a uniform language, so everything is an expression, and thus nesting is arbitrary, so
An identity function applied to itself returns itself
((lambda x x) (lambda x x))
The accumulator pattern is expressed “naturally” (using an explicit bindings syntax)
(define factorail (lambda (x) (define recur (lambda (n acc) (if (zero? n) acc (recur (- n 1) (* n acc))))) (recur x 1)))