tisp

tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | LICENSE

commit 606233e93e498cd6a0ca72c5684eb09ff3c2bdf2
parent 6b3cf4de18170e95508c2ad8a33e2265abaf4e72
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Fri, 27 Sep 2019 18:32:54 -0700

Use cons? to check if a value is a single cons

Diffstat:
tibs/lib.tsp | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tibs/lib.tsp b/tibs/lib.tsp @@ -43,7 +43,7 @@ (define (function? x) (= (type x) "function")) (define (macro? x) (= (type x) "macro")) (define (pair? x) (= (type x) "pair")) -(define cons? pair?) +(define (cons? x) (and (pair? x) (not (pair? (cdr x))))) (define (list? x) (and (pair? x) (pair? (cdr x)))) (define (boolean? x) (or (= x t) (nil? x))) (define (true? x) (= x t))