• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
      • Io
        • Fmt
        • Msg
        • Cw
        • Set-evisc-tuple
        • Set-iprint
        • Print-control
        • Read-file-into-string
        • Msgp
        • Std/io
        • Printing-to-strings
        • Evisc-tuple
        • Output-controls
        • Observation
        • *standard-co*
        • Pp-special-syms
        • Standard-oi
        • Standard-co
        • Without-evisc
        • Serialize
          • With-serialize-character
          • Unsound-read
          • Serialize-read
            • Serialize-in-books
            • Print-compressed
            • Print-legibly
            • Serialize-write
            • Set-serialize-character-system
            • Serialize-alternatives
          • Output-to-file
          • Fmt-to-comment-window
          • Character-encoding
          • Princ$
          • Open-output-channel!
          • Cw-print-base-radix
          • Set-print-case
          • Set-print-base
          • Print-object$
          • Fmx-cw
          • Print-object$+
          • Set-print-radix
          • Extend-pathname
          • Set-fmt-hard-right-margin
          • Proofs-co
          • File-write-date$
          • Set-print-base-radix
          • Print-base-p
          • *standard-oi*
          • Wof
          • File-length$
          • Fms!-lst
          • *standard-ci*
          • Write-list
          • Fmt!
          • Fms
          • Delete-file$
          • Cw!
          • Fmt-to-comment-window!
          • Fms!
          • Eviscerate-hide-terms
          • Fmt1!
          • Fmt-to-comment-window!+
          • Read-file-into-byte-array-stobj
          • Fmt1
          • Fmt-to-comment-window+
          • Cw-print-base-radix!
          • Read-file-into-character-array-stobj
          • Cw!+
          • Newline
          • Fmx
          • Cw+
          • Read-object-from-file
          • Set-fmt-soft-right-margin
          • Read-objects-from-file
          • Read-file-into-byte-list
          • Read-file-into-character-list
        • Defttag
        • Sys-call
        • Save-exec
        • Quicklisp
        • Oslib
        • Std/io
        • Bridge
        • Clex
        • Tshell
        • Unsound-eval
        • Hacker
        • Startup-banner
        • Command-line
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Serialize
    • ACL2-built-ins

    Serialize-read

    Read a serialized ACL2 object from a file

    General form:

    (serialize-read filename
                    [:hons-mode {:always, :never, :smart}]   ; :smart by default
                    [:verbosep  {t, nil}])                   ; nil by default
     -->
    (mv obj state)

    In the logic this is an oracle read.

    Under the hood, we try to read and return a serialized object from a file that was presumably created by serialize-write. On success we return the contents of the file. Any failures (e.g., file not found, bad file contents, etc.) will result in a hard Lisp error.

    The filename should be a string that gives the path to the file.

    The hons-mode controls how whether to use hons or cons to restore the object. The default mode is :smart, which means that conses that were normed at the time of the file's creation should be restored with hons. But you can override this and insist that hons is to :always or :never be used, instead.

    Why would you use :never? If your object previously had a lot of honses, but you no longer have any need for them to be normed, then using :never may sometimes be a lot faster since it can avoid hons calls. On the other hand, if you are going to hons-copy some part of the file's contents, then it is likely faster to use :smart or :always instead of first creating normal conses and then copying them to build honses.

    The :verbosep flag just controls whether to print some low-level details related to timing and memory usage as the file is being read.