# Why Scheme?

## Why is `matrico`

developed in Scheme?

`matrico`

is a passion project, written in the language, I came to enjoy programming in most: Scheme.
Originally, I planned to develop a matrix focussed domain-specific language (DSL),
so I arrived first at Racket promoting language-oriented programming,
then I tried Common Lisp before finally arriving at Scheme.
I then started `matrico`

as a practical means of learning and improving an actual Scheme code.
However, Lisps and Schemes are classically known for symbolic, not numerically compute capabilities, and modernly numerical libraries are still not too common.
So `matrico`

is filling a niche, I naturally feel drawn to as a numerical mathematician.

### Lisp

Scheme is a Lisp (originally LISP, for LISt Processor); which was invented by J.McCarthy in 1958 (see: doi:10.1145/367177.367199 or: www-formal.stanford.edu/jmc/recursive.html ), and as such it is the second oldest programming language after FORTRAN. On the one hand, Lisp(s) are based on polish notation S-expressions, which results in a simple, unambiguous syntax, without operator precendence rules, and lists as the basic data structure. On the other hand, Lisp(s) encourage functional programming, which means the use of pure functions, immutability of bindings, map/reduce concepts, and recursion instead of loops.

### Scheme

Scheme (short for Schemer, abbreviated due to a technical six character limit) was invented by G.L.Steele and G.J.Sussman in 1975, is a standardized minimalistic dialect of Lisp. For the interested reader, here are these Scheme “standards”:

- R0RS - SCHEME: An Interpreter for Extended Lambda Calculus (1975)
- R1RS - Revised Scheme Report (1978)
- R2RS - Revised^2 Scheme Report (1985)
- R3RS - Revised^3 Scheme Report (1986)
- IEEE/ANSI Scheme Standard (1991)
- R4RS - Revised^4 Scheme Report (1991)
- R5RS - Revised^5 Scheme Report (1998)
- ER^5RS - Extended Revised^5 Scheme Report (2007)
- R6RS - Revised^6 Scheme Report (2007)
- R7RS - Revised^7 Scheme Report (2013)

In summary, Scheme is interpreted (or compiled), dynamically but strictly typed, lexically scoped, and eagerly evaluated. Scheme originates mainly from Lisp, but also from ALGOL and Planner. Essentially, Scheme reflects lambda calculus, and also features tail recursion, hygenic macros, as well as typically an interactive environment, a so-called REPL (Read-Evaluate-Print-Loop). Due to the minimality of Scheme (i.e. R5RS has merely 50 pages), there is also a set of reviewed implementation-agnostic extension libraries defined, see:

Scheme used to be a widely spread language taught at universites, likely due to the exceptional computer science text book SICP - Structure and Interpretation of Computer Programs, which employs Scheme. Nowadays, Scheme seems not too popular, i.e. the current TIOBE index (April 2022) is below 50, with an all-time high of 15 (June 2002). However, Scheme is still very much alive.

To get a feel for the Scheme language, check Category:Scheme - Rosetta Code.

### Scheme for Numerics

There are programming languages focusing on array programming or matrix operations, such as FORTRAN, MATLAB, or more recently Julia,
which are in a sense domain-specific languages (DSL). So why am I developing a matrix library in a list-based language?
Well, Scheme has such a minimal syntax that adding functionality with new libraries or modules is almost like developing a DSL.
And the data-driven map-reduce ansatz in Scheme (or Lisps in general) enables an abstract design.
Also, I will use lists to my advantage in `matrico`

.

All in all, I was looking for a minimalistic language, with clear syntax that makes functional programming natural, hence I chose Scheme.
The particular Scheme impementation I selected for developing `matrico`

is CHICKEN Scheme, whose advantages will be explained in the next blog post.