commit 07594c6fc2a0546fd3c6115ba17dc3b56ae61714
parent 8a9b658cc665222ad72546e5bbbc721a88171951
Author: Ed van Bruggen <edvb@uw.edu>
Date: Sat, 1 Jan 2022 21:24:55 -0500
Add not equal function
Diffstat:
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/test.c b/test.c
@@ -162,6 +162,8 @@ char *tests[][2] = {
{ "(= (+ 1 1) (+ 2 0))", "True" },
{ "(= \"foo\" \"foo\")", "True" },
{ "(= \"foo\" \"bar\")", "Nil" },
+ { "(= \"foo\" 'foo)", "Nil" },
+ { "(= 'bar 'bar)", "True" },
{ "(= \"foo\" \"foo\" \"foo\" \"foo\" \"foo\")", "True" },
{ "(= \"foo\" \"bar\" \"foo\" \"foo\" \"foo\")", "Nil" },
{ "(= \"foo\" 3)", "Nil" },
@@ -171,7 +173,7 @@ char *tests[][2] = {
{ "(= car car)", "True" },
{ "(= car cdr)", "Nil" },
{ "(= quote quote quote)", "True" },
- { "(= '(1 2 3) '(1 2 3))", "True" },
+ { "(= '(1 2 3) (list 1 2 3))", "True" },
{ "(= '(a b c) '(a b c))", "True" },
{ "(= '(a b c) '(a b d))", "Nil" },
{ "(= '(1 2 3) '(1 2))", "Nil" },
@@ -180,6 +182,13 @@ char *tests[][2] = {
{ "(= '((1 b) 3 4) '((1 2) 3 4))", "Nil" },
{ "(= (Func (it) it) @it)", "True" },
{ "(= @it (Func (x) x))", "Nil" },
+ { "(/=)", "Nil" },
+ { "(/= 'a)", "Nil" },
+ { "(/= '(1 . 2) (list* 1 2))", "Nil" },
+ { "(/= 1 2)", "True" },
+ { "(/= 1 1 2 1 1 1)", "True" },
+ { "(/= \"foo\" \"bar\")", "True" },
+ { "(/= 'greg 'greg 'greg 'greg)", "Nil" },
{ "def", NULL },
{ "(def foo 4)", "(Void)" },
diff --git a/tib/math.tsp b/tib/math.tsp
@@ -6,6 +6,8 @@
;;; Functions
+; TODO rem
+(def /= (compose not =))
(def (inc x) (+ x 1))
(def (dec x) (- x 1))
(def (truncate x) (* (floor (abs x)) (sgn x)))