Subject: Re: Interesting type issue (a.k.a. breaking your programs using specialised arrays and print/read)
From: rpw3@rpw3.org (Rob Warnock)
Date: Sat, 13 Dec 2003 05:29:56 -0600
Newsgroups: comp.lang.lisp
Message-ID: <6KicnaTGGdapZUeiXTWc-w@speakeasy.net>
Adam Warner  <usenet@consulting.net.nz> wrote:
+---------------
| (defparameter *a* (read-from-string (format nil "~S" *a*)))
| *a* => #(0.0d0 0.0d0 0.0d0 0.0d0 0.0d0 0.0d0 0.0d0 0.0d0 0.0d0 0.0d0)
...
| (type-of *a*) => (simple-vector 10)
| 
| Moral: You can still use READ but you must manually set each element of
| the original array to the corresponding element of the read array.
+---------------

Well, what about this, then?

	> (make-array 10 :element-type 'double-float
	    :initial-contents '(0d0 1d0 2d0 3d0 4d0 5d0 6d0 7d0 8d0 9d0))

	#(0.0d0 1.0d0 2.0d0 3.0d0 4.0d0 5.0d0 6.0d0 7.0d0 8.0d0 9.0d0)
	> (type-of *) 

	(SIMPLE-ARRAY DOUBLE-FLOAT (10))
	> 


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607