about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-07-11 22:53:51 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-07-11 22:53:51 -0700
commit96ebe1423b427c47d15517373cb26ead057b64c6 (patch)
treed6ac2164ea790351f57a04a80305cacd5e1ac03a
parenta5e757e1abefad8de527f3e7a6e8602cce62d468 (diff)
downloadmu-96ebe1423b427c47d15517373cb26ead057b64c6.tar.gz
22 - better org'n for fn clauses
-rw-r--r--mu.arc4
-rw-r--r--mu.arc.t11
2 files changed, 9 insertions, 6 deletions
diff --git a/mu.arc b/mu.arc
index d556e30a..1953e7c6 100644
--- a/mu.arc
+++ b/mu.arc
@@ -3,6 +3,7 @@
 (def clear ()
   (= types* (obj
               integer (obj size 1)
+              type (obj size 1)
               location (obj size 1)
               address (obj size 1)
               boolean (obj size 1)))
@@ -71,6 +72,9 @@
               eq
                 (= (memory* oarg.0.1)
                    (iso (memory* arg.0.1) (memory* arg.1.1)))
+              neq
+                (= (memory* oarg.0.1)
+                   (~iso (memory* arg.0.1) (memory* arg.1.1)))
               arg
                 (let idx (if arg
                            arg.0
diff --git a/mu.arc.t b/mu.arc.t
index 4c24d0c5..dc4abf0f 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -231,11 +231,10 @@
 (clear)
 (add-fns
   '((add-fn
-      ((integer 4) <- otype 0)
-      ((integer 5) <- loadi 0)  ; type index corresponding to 'integer'
-      ((boolean 6) <- eq (integer 4) (integer 5))
-      (jif (boolean 6) (offset 1))
-      (reply)
+      ((type 4) <- otype 0)
+      ((type 5) <- loadi 0)  ; type index corresponding to 'integer'
+      ((boolean 6) <- neq (type 4) (type 5))
+      (jif (boolean 6) (offset 3))
       ((integer 7) <- arg)
       ((integer 8) <- arg)
       ((integer 9) <- add (integer 7) (integer 8))
@@ -248,5 +247,5 @@
 ;? (prn memory*)
 (if (~iso memory* (obj 1 1  2 3                     3 4
                          ; add-fn's temporaries
-                         4 0  5 0  6 t  7 1  8 3  9 4))
+                         4 0  5 0  6 nil  7 1  8 3  9 4))
   (prn "F - user-defined function with clauses"))