newLISP Fan Club

Forum => newLISP in the real world => Topic started by: kunt on October 10, 2012, 06:47:32 AM

Title: (save) + arrays
Post by: kunt on October 10, 2012, 06:47:32 AM
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
Title: Re: (save) + arrays
Post by: johu on October 11, 2012, 05:38:24 AM
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")))
Title: Re: (save) + arrays
Post by: kunt on October 11, 2012, 06:17:18 AM
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")))))