articles/scheme.md: update

This commit is contained in:
tocariimaa 2025-02-13 23:52:56 -03:00
parent 01874309e3
commit 362faf9150

View file

@ -10,16 +10,19 @@ the version), being the most popular the R5RS revision released in 1998.
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.
a big language for practical use and a small, minimalistic version. Of course R7RS is still
less bloated than [Common Lisp](common_lisp.md) and other mainstream languages.
## Implementations
Since Scheme (specially the R5RS standard) is simple, there are multiple implementations:
- [CHICKEN Scheme](https://call-cc.org/): compiler (AOT) and interpreter.
- [CHICKEN Scheme](https://call-cc.org/): compiler and interpreter, supports extensions in a modular way,
called "eggs".
- [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.
- [GNU Guile](https://www.gnu.org/software/guile/): main Scheme implementation of the GNU project, used as a scripting language in some GNU projects.
- [Gambit Scheme](https://gambitscheme.org/)
- [Chibi Scheme](https://synthcode.com/scheme/chibi/): small implementation with a focus in being embeddable.
- [Cyclone Scheme](https://justinethier.github.io/cyclone/): compiler, aims to support the R7RS standard.
- ...
## Examples
@ -30,18 +33,17 @@ Since Scheme (specially the R5RS standard) is simple, there are multiple impleme
### Factorial
```scheme
;;; Tail recursive factorial
(define (fact n acc)
(if (zero? n)
acc
(fact (- n 1) (* acc 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))
(display n)
(display "! = ")
(display (fact n 1))
(newline))
ns))
```
@ -55,3 +57,5 @@ Since Scheme (specially the R5RS standard) is simple, there are multiple impleme
- <https://docs.scheme.org/>
- [Teach Yourself Scheme in Fixnum Days](https://docs.scheme.org/tyscheme/)
- [R7RS site](https://r7rs.org/)
- The *CONS Should Not CONS Its Arguments, Part II: Cheney on the M.T.A.* paper,
describes how to compile Scheme to C efficiently by using CPS.