summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2021-09-16 15:03:28 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2021-09-16 15:03:28 +0900
commita09b56609dfd645bdaa97b6d6b9ffee06892e8e4 (patch)
tree35b487fb000e46d16b2791ea8d90b75b7a5ac84c
parentfd0554fcd9cf83d126355464f4e9719ed7338a95 (diff)
Fix `if` syntax.
* vikalpa.scm (rewrite/eval): Fix `if` syntax.
-rw-r--r--tests/test-vikalpa-equal-t-nil.scm3
-rw-r--r--tests/test-vikalpa.scm6
-rw-r--r--vikalpa.scm7
3 files changed, 13 insertions, 3 deletions
diff --git a/tests/test-vikalpa-equal-t-nil.scm b/tests/test-vikalpa-equal-t-nil.scm
index 251fd10..f3ce61f 100644
--- a/tests/test-vikalpa-equal-t-nil.scm
+++ b/tests/test-vikalpa-equal-t-nil.scm
@@ -429,4 +429,7 @@
(test-equal '()
(system-check (test)))
+(test-equal '(result/expr (quote b))
+ (system-eval (test) '(if 'nil 'a 'b)))
+
(test-end "test-vikalpa-equal-t-nil")
diff --git a/tests/test-vikalpa.scm b/tests/test-vikalpa.scm
index 961d683..644cb6a 100644
--- a/tests/test-vikalpa.scm
+++ b/tests/test-vikalpa.scm
@@ -418,4 +418,10 @@
(test-equal '()
(system-check (test)))
+(test-equal '(result/expr (quote b))
+ (system-eval (test) '(if #f 'a 'b)))
+
+(test-equal '(result/expr (quote b))
+ (system-eval (test) '(if '#f 'a 'b)))
+
(test-end "test-vikalpa")
diff --git a/vikalpa.scm b/vikalpa.scm
index 96a2c17..dbf032b 100644
--- a/vikalpa.scm
+++ b/vikalpa.scm
@@ -719,9 +719,10 @@
(let ((test/result (eval (result/expr (if-form-test expr)))))
(if (result/error? test/result)
test/result
- (if (expr-unquote (result/expr-expr test/result))
- (eval (result/expr (if-form-then expr)))
- (eval (result/expr (if-form-else expr)))))))
+ (if (equal? (result/expr-expr test/result)
+ (false))
+ (eval (result/expr (if-form-else expr)))
+ (eval (result/expr (if-form-then expr)))))))
((variable? expr)
(result/error 'eval 'variable-found expr))
(else