[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Feb 25 20:02:48 1997 
Subject:reading and writing a complex file in Poplog lisp 
From:Tony Lennard 
Volume-ID:970225.01 

Hello All,

I have a lisp data structure, which I need to read and write to a file.
After a certain number of imbedded lists (the critical number seems to be
13) - it does not read correctly - with a space appearing in the lisp
object name. Has anyone any ideas - I've been playing with it all day now :->

If it makes a difference - I am using Poplog 15.0 The code is below.
Also *print-length* and *print-level* are both nil

Thanks

Tony.

(setq *test*
    '(can (anyone (please (explain (why (I (can (not (read (and (write
        (a (structure like this))))))))))))))

;;; output to a file
(defun output-test ()
   (setf output-file
      (open "test_file.dat" :direction :output :if-exists :supersede))
   (setf output-stream (make-broadcast-stream output-file))
   (prin1 *test* output-stream)
   (close output-stream)
   (close output-file))

;;; then read it back again into *test2*
(defun read-test ()
   (setf input-file (open "test_file.dat" :direction :input))
   (setf input-stream (make-concatenated-stream input-file))
   (setq *test2* (read input-stream t))
   (close input-stream)
   (close input-file))

;;; == producing the result
;;; (nthcdr 11 (pop11:flatten *test2*))
;;; (A STRUCT URE LIKE THIS)
;;; == (nthcdr 11 (pop11:flatten *test*))
;;; (A STRUCTURE LIKE THIS)