[CM] question about pretty-print and object serialization

Iain Duncan iainduncanlists at gmail.com
Sat Jan 15 09:52:16 PST 2022


Hi Bill and list, I've been playing with the pretty-print function in
write.scm in further attempts to make a nice "back to code" serializer for
my sequencers. I have the back to text part working at a basic level using
the below, but it comes out as one long line.

(define (save-seq seq-obj filename)
  (let ((data (object->string (seq-1 'get '_) :readable)))
    (call-with-output-file filename
      (lambda (port) (write data port)))))

It would be great to be able to use pretty-print to have it formatted with
nice indendtation, but (pp obj) doesn't print entire vectors, they end with
the ... stuff. Is there a way to use pretty-print with object->string to
get a pretty printed dump that has everything one needs to reload via
eval-string? Or some other approach that I haven't thought of? Figured I'd
ask before I start mucking with regex's.

thanks!
iain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20220115/284d7e89/attachment.html>


More information about the Cmdist mailing list