Newsgroups: comp.lang.pop
Subject: reading and writing a complex file in Poplog lisp
Organization: Computing Department, Lancaster University.
From: anl@comp.lancs.ac.uk (Tony Lennard)
NNTP-Posting-Host: sea.comp.lancs.ac.uk
Message-ID: <33134568.0@info.comp.lancs.ac.uk>
Date: 25 Feb 97 20:02:48 GMT
Lines: 41
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!gatech!news.mathworks.com!rill.news.pipex.net!pipex!uknet!usenet1.news.uk.psi.net!uknet!uknet!yama.mcc.ac.uk!news.lancs.ac.uk!info.comp.lancs.ac.uk!anl

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)

