tisp

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

commit 1171d2e4fe06981888a5cb2c290bd325c535dd84
parent df04febf77d29d451d7055630f08964a2e94fb72
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Sat, 14 Mar 2020 21:44:02 -0700

Add boolean type caster

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

diff --git a/tibs/lib.tsp b/tibs/lib.tsp @@ -58,9 +58,11 @@ (define (rational? x) (or (integer? x) (ratio? x))) (define (number? x) (or (rational? x) (decimal? x))) -(defmacro (assert condition) - `(unless ,condition - (error 'assert "assertion " ',condition " failed"))) +(define (bool x) (if x t nil)) + +(defmacro (assert expr) + `(unless ,expr + (error 'assert "assertion " ',expr " failed"))) ;;; Control Flow ; TODO if b = pair and car b = else use cdr b