articles/scheme.md: new article
This commit is contained in:
parent
4102a4a2fa
commit
93a99e16c4
1 changed files with 42 additions and 0 deletions
42
articles/scheme.md
Normal file
42
articles/scheme.md
Normal file
|
@ -0,0 +1,42 @@
|
|||
# Scheme
|
||||
Scheme is [Lisp](lisp.md) dialect created in 1975 by Guy Steele and Gerald Sussman at the MIT. Scheme is
|
||||
minimalistic and elegant leaning towards a functional programming paradigm, being the language used in the
|
||||
famous [SICP](sicp.md) book (using the MIT/GNU Scheme implementation).
|
||||
|
||||
Scheme is standardized in a series of documents called *Revised Report on the Algorithmic Language Scheme* (RnRS) (where the `n` stands for
|
||||
the version), being the most popular revision the R5RS standard released in 1998.
|
||||
|
||||
## Controversy around the R6RS revision (The Great Bloatening)
|
||||
In 2003 work in a new revision of Scheme began, R6RS, finished in 2007. This new revision was controversial since it
|
||||
added additional features that Scheme hackers deemed as a departure from Scheme's minimalism. In a attempt to amend this,
|
||||
work on R7RS began, splitting Scheme into two different (but still similar) languages, differing in the amount of features;
|
||||
a big language for "practical" use and a small minimalistic version.
|
||||
|
||||
## Implementations
|
||||
Since Scheme (specially the R5RS standard) is simple, there are multiple implementations:
|
||||
- [CHICKEN Scheme](https://call-cc.org/): compiler (AOT) and interpreter.
|
||||
- [MIT/GNU Scheme](https://www.gnu.org/software/mit-scheme/): compiler, one of the "original" implementations, also includes a debugger.
|
||||
- [Chez Scheme](https://cisco.github.io/ChezScheme/): another classic compiler, freed in 2016.
|
||||
- ...
|
||||
|
||||
## Examples
|
||||
### Hello World
|
||||
```scheme
|
||||
(display "Hello, Scheme!")
|
||||
```
|
||||
|
||||
### Factorial
|
||||
```scheme
|
||||
(define (fact n acc)
|
||||
(if (zero? n)
|
||||
acc
|
||||
(fact (- n 1) (* acc n))))
|
||||
|
||||
(let ((ns '(4 0 5 10 1)))
|
||||
(for-each (lambda (n)
|
||||
(display n)
|
||||
(display "! = ")
|
||||
(display (fact n 1))
|
||||
(newline))
|
||||
ns))
|
||||
```
|
Loading…
Add table
Reference in a new issue