ref: c400506dffc50ab1b939714d64c8edccd4a73a41
parent: 4cf907cc035cd84c90b4270f758d382861c15451
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Mon Dec 9 19:04:46 EST 2024
aref: fix multiindex on arrays
--- a/flisp.c
+++ b/flisp.c
@@ -1281,7 +1281,8 @@
bounds_error(v, e);
v = vector_elt(v, isz);
}else if(__likely(isarray(v))){
- v = cvalue_array_aref(&FL(stack)[FL(sp)-i]);
+ FL(stack)[FL(sp)-i-1] = v;
+ v = cvalue_array_aref(&FL(stack)[FL(sp)-i-1]);
}else{
type_error("sequence", v);
}
--- a/test/unittest.lsp
+++ b/test/unittest.lsp
@@ -419,6 +419,10 @@
(assert (equal? 7 (aref a 1 2)))
(assert (equal? 5 (aref a 1 1 1)))
(assert-fail (aref a 1 1 3) bounds-error)
+(assert (equal? (fixnum #\l) (aref #("hello") 0 2)))
+(assert (equal? (fixnum #\o) (aref #("hello") 0 4)))
+(assert-fail (aref #("hello") 0 5))
+(assert-fail (aref #("hello") 1 0))
;; make many initialized tables large enough not to be stored in-line
(for 1 100 (λ (i)