about summary refs log tree commit diff stats
path: root/mu.arc.t
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-10-05 20:03:03 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-10-05 20:03:03 -0700
commit62fc8a7b99f6dc5a9bc06cd682025e465c21ca02 (patch)
tree53c004d2cd92a7894b986d812b848ad91fb50ae4 /mu.arc.t
parentdaff44a21eb533b3774b965912a9df695a25e172 (diff)
downloadmu-62fc8a7b99f6dc5a9bc06cd682025e465c21ca02.tar.gz
111 - no, can't mix array and record access
records need literal offsets; arrays need variables.
Diffstat (limited to 'mu.arc.t')
-rw-r--r--mu.arc.t28
1 files changed, 22 insertions, 6 deletions
diff --git a/mu.arc.t b/mu.arc.t
index 15de917a..868de132 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -442,7 +442,7 @@
 (run 'main)
 ;? (prn memory*)
 (if (~iso memory* (obj 1 34  2 t  3 1  4 2))
-  (prn "F - 'get-address' returns address of fields of records"))
+  (prn "F - 'get-address' accesses fields of record address"))
 
 (reset)
 (add-fns
@@ -452,11 +452,26 @@
       ((3 boolean) <- literal nil)
       ((4 integer) <- literal 24)
       ((5 boolean) <- literal t)
-      ((6 integer-boolean-pair) <- get (1 integer-boolean-pair-array) (1 offset)))))
+      ((6 integer-boolean-pair) <- index (1 integer-boolean-pair-array) (1 literal)))))
 (run 'main)
 ;? (prn memory*)
 (if (~iso memory* (obj 1 2  2 23 3 nil  4 24 5 t  6 24 7 t))
-  (prn "F - 'get' accesses indices of arrays"))
+  (prn "F - 'index' accesses indices of arrays"))
+
+(reset)
+(add-fns
+  '((main
+      ((1 integer) <- literal 2)
+      ((2 integer) <- literal 23)
+      ((3 boolean) <- literal nil)
+      ((4 integer) <- literal 24)
+      ((5 boolean) <- literal t)
+      ((6 integer) <- literal 1)
+      ((7 integer-boolean-pair) <- index (1 integer-boolean-pair-array) (6 integer)))))
+(run 'main)
+;? (prn memory*)
+(if (~iso memory* (obj 1 2  2 23 3 nil  4 24 5 t  6 1  7 24 8 t))
+  (prn "F - 'index' accesses indices of arrays"))
 
 (reset)
 (add-fns
@@ -466,11 +481,12 @@
       ((3 boolean) <- literal nil)
       ((4 integer) <- literal 24)
       ((5 boolean) <- literal t)
-      ((6 integer-boolean-pair-address) <- get-address (1 integer-boolean-pair-array) (1 offset)))))
+      ((6 integer) <- literal 1)
+      ((7 integer-boolean-pair-address) <- index-address (1 integer-boolean-pair-array) (6 integer)))))
 (run 'main)
 ;? (prn memory*)
-(if (~iso memory* (obj 1 2  2 23 3 nil  4 24 5 t  6 4))
-  (prn "F - 'get-address' returns addresses of indices of arrays"))
+(if (~iso memory* (obj 1 2  2 23 3 nil  4 24 5 t  6 1  7 4))
+  (prn "F - 'index-address' returns addresses of indices of arrays"))
 
 (reset)
 (add-fns