Posted By

jarnaldich on 02/21/08


Tagged

file


Versions (?)

Serializing in Lisp


 / Published in: Lisp
 

Example of serializing a lisp variable.

  1. ;;; Save
  2. (defun save-obj (filename obj)
  3. (with-open-file (out filename
  4. :direction :output
  5. :if-exists :supersede)
  6. (with-standard-io-syntax
  7. (print obj out))))
  8.  
  9. ;;; Load
  10. (defun load-obj (filename obj)
  11. (with-open-file (in filename)
  12. (with-standard-io-syntax
  13. (setf obj (read in)))))

Report this snippet  

You need to login to post a comment.