(save) + arrays

Started by kunt, October 10, 2012, 06:47:32 AM

Previous topic - Next topic

kunt

hello.



it looks like (save) does not handle arrays correctly.

i have a 3-dimensional array and want to save it to a file for further re-initialization, but it fails.



what i get after (save) in a file:



(set 'world-root (array 1 1 1 (flat '(
  (((nil 1 "data/maps/start.lisp")))))))


and if we eval this we get:



> (set 'world-root (array 1 1 1 (flat '((((nil 1 "data/maps/start.lisp")))))))

(((nil)))





which is not correct.

any suggestions?



ps: newlisp-10.4.3

johu

#1
I don't know what your 3-dimensional array is meaning, sorry.

But I think

> (set 'world-root (array 3 (flat '((((nil 1 "data/maps/start.lisp")))))))
(nil 1 "data/maps/start.lisp")

Or following?

> (set 'world-root (array 3 1 1 (flat '((((nil 1 "data/maps/start.lisp")))))))
(((nil)) ((1)) (("data/maps/start.lisp")))
> (set 'world-root (array 1 3 1 (flat '((((nil 1 "data/maps/start.lisp")))))))
(((nil) (1) ("data/maps/start.lisp")))
> (set 'world-root (array 1 1 3 (flat '((((nil 1 "data/maps/start.lisp")))))))
(((nil 1 "data/maps/start.lisp")))

kunt

#2
i initialize 3-dimensional array w/ only one element, as follows:

(define world-root (array 1 1 1 (list world-new-entry)))

the number of elements is being increased during the program execution. every element is a list.

and even this simple situation does not work.



for now i switched to lists entirely, they perform much better, after serialization i get:



(set 'world-root '(
  (((nil 1 "data/maps/start.lisp")))))