类似于CLJS-2113,但对{{aget}}
Clojure
user=> (aget (to-array [nil 1]) -1) ArrayIndexOutOfBoundsException -1 clojure.lang.RT.aget (RT.java:2336) user=> (aget (to-array [nil 1]) 0) nil user=> (aget (to-array [nil 1]) 0.5) nil user=> (aget (to-array [nil 1]) 1) 1 user=> (aget (to-array [nil 1]) 1.5) 1 user=> (aget (to-array [nil 1]) 2) ArrayIndexOutOfBoundsException 2 clojure.lang.RT.aget (RT.java:2336)
ClojureScript
cljs.user=> (aget (to-array [nil 1]) -1) nil cljs.user=> (aget (to-array [nil 1]) 0) nil cljs.user=> (aget (to-array [nil 1]) 0.5) nil cljs.user=> (aget (to-array [nil 1]) 1) 1 cljs.user=> (aget (to-array [nil 1]) 1.5) nil cljs.user=> (aget (to-array [nil 1]) 2) nil
值得注意的是,Clojure在向最接近的整数索引舍入时表现得好像ClojureScript没有这样做。
(aget (to-array [1 2]) 0.5)
在Clojure中返回{{1}},在ClojureScript中返回{{nil}}。
(假设,对于{{aset}}也有类似的结果。)