From 44ef71c6587b9dae79ff04dcb583f9876a6bcf90 Mon Sep 17 00:00:00 2001 From: tocariimaa Date: Sat, 15 Feb 2025 13:04:13 -0300 Subject: [PATCH] articles/lisp.md: update --- articles/lisp.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/articles/lisp.md b/articles/lisp.md index 9c28547..014934f 100644 --- a/articles/lisp.md +++ b/articles/lisp.md @@ -18,10 +18,10 @@ a Lisp could be built in terms of lambdas. For example, using Church encoding th (define (car p) (p (lambda (x y) x))) (define (cdr p) (p (lambda (x y) y))) -(cdr (cons 'A 'B)) ; B -(car (cons 'A 'B)) ; A -(car (cdr (cons 'A (cons 'B 'C)))) ; B -(cdr (cdr (cons 'A (cons 'B 'C)))) ; C +(cdr (cons 'A 'B)) ; ==> B +(car (cons 'A 'B)) ; ==> A +(car (cdr (cons 'A (cons 'B 'C)))) ; ==> B +(cdr (cdr (cons 'A (cons 'B 'C)))) ; ==> C ``` A PDF of the original Lisp 1.5 manual can be found here: . Head to page 13 for @@ -43,9 +43,9 @@ Here's cons cell: To create a cell, the builtin function `cons` is used: ```lisp -(cons 1 2) ; 1 and 2 are the car and cdr respectively -(car (cons 1 2)) ; ==> 1 -(cdr (cons 1 2)) ; ==> 2 +(cons 1 2) ; 1 and 2 are the car and cdr respectively +(car (cons 1 2)) ; ==> 1 +(cdr (cons 1 2)) ; ==> 2 ;; Also some Lisps accept the "dotted pair" notation as a shorthand: (1 . 2) ``` @@ -100,5 +100,5 @@ you're seeing the source encoded in a tree, directly by using S-Expressions. But under a Lisp skin. - ... -## Examples -TODO +## See Also +- [Forth](forth.md)