This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
GeneralArray.toString
- From: Chris Dean <Chris dot Dean at sokitomi dot com>
- To: Kawa List <kawa at sources dot redhat dot com>
- Date: Sat, 05 Apr 2003 14:09:20 -0800
- Subject: GeneralArray.toString
Some SRFI-25 arrays can throw an exception when they are printed. For
example:
(format "~A" (make-array (shape 1 2)))
Throws java.lang.UnsupportedOperationException: gnu.lists.GeneralArray does not implement nextIndex
at gnu.lists.AbstractSequence.unsupported(AbstractSequence.java:74)
at gnu.lists.AbstractSequence.nextIndex(AbstractSequence.java:374)
at gnu.lists.AbstractSequence.hasNext(AbstractSequence.java:394)
at gnu.lists.AbstractSequence.nextPos(AbstractSequence.java:425)
at gnu.lists.AbstractSequence.toString(AbstractSequence.java:699)
at gnu.lists.AbstractSequence.toString(AbstractSequence.java:714)
...
It's not clear to me what the correct fix is, but to aid in the
diagnosis there is a patch to arr-test.scm below.
Thanks!
Regards,
Chris Dean
Index: arr-test.scm
===================================================================
RCS file: /cvs/kawa/kawa/testsuite/arr-test.scm,v
retrieving revision 1.2
diff -u -r1.2 arr-test.scm
--- arr-test.scm 13 Mar 2003 18:32:28 -0000 1.2
+++ arr-test.scm 5 Apr 2003 09:10:46 -0000
@@ -1,4 +1,4 @@
-(test-init "arrays" 164)
+(test-init "arrays" 168)
;;; array test
;;; 2001 Jussi Piitulainen
@@ -385,3 +385,9 @@
(define a-2-9 (make-array (shape 0 2 0 9)))
(array-set! a-2-9 1 3 'e)
(test 'e array-ref a-2-9 1 3)
+
+;; Convert to string
+(test "#(#!null #!null)" '0x2 (format "~A" (make-array (shape 0 2))))
+(test "#(#!null)" '1x2 (format "~A" (make-array (shape 1 2))))
+(test "#()" '0x0 (format "~A" (make-array (shape 0 0))))
+(test "#((#!null #!null))" '0x2-0x2 (format "~A" (make-array (shape 0 2 0 2)))