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-08-21 20:33:29 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-08-21 20:35:52 -0700
commit6a2edbe8cad4547921fa6d7307af47b5190a2b48 (patch)
tree8189cfb81f5d48b71082d102265e3c5909d27036 /mu.arc.t
parent6f9bf3a063470d02cfaff0601281e39ee315e6a3 (diff)
downloadmu-6a2edbe8cad4547921fa6d7307af47b5190a2b48.tar.gz
65 - separate op for array indexing
'get' no longer supports that case; that was confusing.
Diffstat (limited to 'mu.arc.t')
-rw-r--r--mu.arc.t21
1 files changed, 17 insertions, 4 deletions
diff --git a/mu.arc.t b/mu.arc.t
index a626bcda..6dfb7824 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -366,12 +366,25 @@
       ((3 boolean) <- literal nil)
       ((4 integer) <- literal 24)
       ((5 boolean) <- literal t)
-      ((6 integer) <- get (1 integer-boolean-pair-array) (0 offset))
-      ((7 integer-boolean-pair) <- get (1 integer-boolean-pair-array) (1 offset)))))
+      ((6 integer) <- get (1 integer-boolean-pair-array) (0 offset)))))
 (run function*!main)
 ;? (prn memory*)
-(if (~iso memory* (obj 1 2  2 23 3 nil  4 24 5 t  6 2  7 23 8 nil))
-  (prn "F - 'get' accesses fields of arrays, with length at index 0"))
+(if (~iso memory* (obj 1 2  2 23 3 nil  4 24 5 t  6 2))
+  (prn "F - 'get' accesses length of array"))
+
+(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-boolean-pair) <- aref (1 integer-boolean-pair-array) (1 offset)))))
+(run function*!main)
+;? (prn memory*)
+(if (~iso memory* (obj 1 2  2 23 3 nil  4 24 5 t  6 24 7 t))
+  (prn "F - 'aref' accesses indices of arrays"))
 
 ; todo: test that out-of-bounds access throws an error