articles/lisp.md: update
This commit is contained in:
parent
765b8db461
commit
6aa4a0eeb0
1 changed files with 3 additions and 1 deletions
|
@ -9,7 +9,8 @@ out to be more popular and Lisps began using it.
|
|||
|
||||
Unlike other languages at the time and also modern languages, Lisp is homoiconic, that is, Lisp source code is data that can be manipulated
|
||||
by the program itself. This gives Lisp powerful metaprogramming capabilities through the use of macros which modify the program data at compile
|
||||
time. Therefore, Lisp source code directly represents the program as a tree without extra superfluous syntax (as in "mainstream" [programming languages](programming_language.md)).
|
||||
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:
|
||||
|
@ -23,6 +24,7 @@ a Lisp could be built in terms of lambdas. For example, using Church encoding th
|
|||
(car (cdr (cons 'A (cons 'B 'C)))) ; ==> B
|
||||
(cdr (cdr (cons 'A (cons 'B 'C)))) ; ==> C
|
||||
```
|
||||
By using lambdas you could also implement arithmetic from scratch, including numbers themselves.
|
||||
|
||||
A PDF of the original Lisp 1.5 manual can be found here: <https://www.lispmachine.net/books/LISP_1.5_Programmers_Manual.pdf>. Head to page 13 for
|
||||
enlightenment.
|
||||
|
|
Loading…
Add table
Reference in a new issue