This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
(array index)
- From: Ito Kazumitsu <kaz at maczuka dot gcd dot org>
- To: kawa at sourceware dot org
- Date: Wed, 21 Nov 2012 23:59:15 +0900 (JST)
- Subject: (array index)
Hi,
The syntax (array index) is explained in the Kawa Document
[Object, Classes and Modules]-[Using Java Arrays].
I happened to find that this syntax works not only for
Java arrays but also for vectors, lists, and java.util.ArrayList
instances.
#|kawa:1|# (define v (vector "a" "b" "c"))
#|kawa:2|# (define l (list "a" "b" "c"))
#|kawa:3|# (define a (java.util.ArrayList))
#|kawa:4|# (a:add "a")(a:add "b")(a:add "c")
#t #t #t
#|kawa:5|# (v 2)
c
#|kawa:6|# (set! (v 2) "x")
#|kawa:7|# v
#(a b x)
#|kawa:8|# (l 2)
c
#|kawa:9|# (a 2)
c
#|kawa:10|# (set! (a 2) "x")
#|kawa:11|# a
[a, b, x]
Is the syntax (array index) where array is a general sequence object
explained anywhere in the Kawa Document?
Is it safe to use this syntax for a general sequence object?