tisp

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

commit c1c14eacf0133b890659b0a205f4d4cb539192de
parent 1288fd4ee1199f27f7e5cb8789afdbb330c68d84
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Sun,  2 Jun 2019 10:39:16 -0700

Fix logic and control functions

Diffstat:
tibs/lib.tsp | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tibs/lib.tsp b/tibs/lib.tsp @@ -62,8 +62,8 @@ ;;; Control Flow (define if - (macro (con a b) - (list 'cond (list con a) (list t b)))) + (macro (con c d) + (list 'cond (list con c) (list t d)))) (define else t) (define when (macro (con . body) @@ -84,10 +84,10 @@ (define nand (macro (a b) (list 'not (list 'and a b)))) -(define (or a b) ; De Morgan's theorem - (nand (not a) (not b))) +(define (or a b) + (if a t (if b t ()))) (define (nor a b) - (and (not a) (not b))) + (not (or a b))) ;;; Lists (define first car)