diff --git a/scm.mes b/scm.mes index e13eedc7..e9ddef52 100755 --- a/scm.mes +++ b/scm.mes @@ -64,3 +64,14 @@ ((null? r) (cons (f (car l)) (map f (cdr l)))) ((null? (cdr r)) (cons (f (car l) (caar r)) (map f (cdr l) (cdar r)))))) + +(define (not x) + (cond (x #f) + (#t #t))) + +(define-macro (if expr then . else) + (cond ((not (eq? (c:eval expr (current-module)) #f)) + then) + (#t + (cond ((pair? else) (car else)) + (#t *unspecified*))))) diff --git a/test.mes b/test.mes index 619f25a0..96a0fe23 100644 --- a/test.mes +++ b/test.mes @@ -124,4 +124,11 @@ (display (= 3 '3)) (newline) +(display (if #t 'true)) +(newline) +(display (if (eq? 0 '0) 'true 'false)) +(newline) +(display (if (= 1 2) 'true 'false)) +(newline) + '()