[cl-prevalence-devel] 2D arrays

Krzysztof Drewniak krzysdrewniak at gmail.com
Fri Jun 11 18:10:42 UTC 2010


On Fri, 2010-06-11 at 06:23 -0500, Krzysztof Drewniak wrote:
> Is there any major problems with getting 2D arrays (sequences of
> sequences) serialized? (I'm working on a game and trying to find a
> serialization libraryt that does what I need)
> 
> Krzysztof Drewniak 
I don't know enough about the workings of s-serialization, but these two
functions might prove useful (thinking: serialize return value of
array->vector, and upon deserialization, pass the list to vector->array)

(defun array->vector (array)
  (let ((dims (array-dimensions array)))
    (list dims (make-array (array-total-size array) :displaced-to
array))))

(defun vector->array (vector)
  (let ((dims (first vector)) (vector (second vector)))
    (make-array dims :displaced-to vector)))

Thank you for the library,

Krzysztof
-- 
X-Real-Email-With-Antispam: krzysdrewniak at gmail dot com
pgp key on keyserver.ubuntu.com and maybe some other place too
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/cl-prevalence-devel/attachments/20100611/eaa2a0a2/attachment.sig>


More information about the Cl-prevalence-devel mailing list