articles/lisp.md: update

This commit is contained in:
tocariimaa 2025-02-16 14:52:17 -03:00
parent 0c95c0b596
commit 3128873a75

View file

@ -12,8 +12,10 @@ by the program itself. This gives Lisp powerful metaprogramming capabilities thr
time. Therefore, Lisp source code directly represents the program as a tree without extra superfluous syntax
(as in mainstream [programming languages](programming_language.md)).
Lisp is built on primitives such as `cons`, `car`, `cdr`, `lambda`, `apply`, `eval` and others. Since it is based on the [lambda calculus](lambda_calculus.md)
a Lisp could be built in terms of lambdas. For example, using Church encoding this is how `cons` cells could be implemented using only lambdas:
A Lisp can be built on a basic set of primitives such as `cons`, `car`, `cdr`, `lambda`, `apply`, `eval`, `eq`, `quote` and others (as decribed in the
Lisp 1.5 manual).
Since it is based on the [lambda calculus](lambda_calculus.md) a Lisp could also be built in terms of lambdas.
For example, using Church encoding this is how `cons` cells could be implemented using only lambdas:
```scheme
(define (cons x y) (lambda (z) (z x y)))
(define (car p) (p (lambda (x y) x)))