• 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
        • Without-evisc
        • Standard-co
        • Serialize
        • Output-to-file
        • Fmt-to-comment-window
        • Character-encoding
        • Princ$
          • Std/io/princ$
          • Newline
        • 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
  • Io
  • ACL2-built-ins

Princ$

Print an atom

Use princ$ to do basic printing of atoms (i.e., other than cons pairs). In particular, princ$ prints a string without the surrounding double-quotes and without escaping double-quote characters within the string. Note that princ$ is sensitive to the print-base, print-radix, and print-case; see set-print-base-radix and see set-print-case. Princ$ returns state.

Examples:
ACL2 !>(princ$ "Howdy ho" (standard-co state) state)
Howdy ho<state>
ACL2 !>(pprogn (princ$ "Howdy ho" (standard-co state) state)
               (newline (standard-co state) state))
Howdy ho
<state>
ACL2 !>(princ$ "ab\"cd" *standard-co* state)
ab"cd<state>
ACL2 !>
ACL2 !>(princ$ 17 *standard-co* state)
17<state>
ACL2 !>(set-print-base 16 state) ; might be nicer to use set-print-base-radix
<state>
ACL2 !>(princ$ 17 *standard-co* state)
11<state>
ACL2 !>(set-print-radix t state)
<state>
ACL2 !>(princ$ 17 *standard-co* state)
#x11<state>
ACL2 !>(princ$ 'xyz *standard-co* state)
XYZ<state>
ACL2 !>(set-print-case :downcase state)
<state>
ACL2 !>(princ$ 'xyz *standard-co* state)
xyz<state>
ACL2 !>

The guard for (princ$ x channel state) is essentially as follows; see io for an explanation of guards of certain built-in functions that take state, such as princ$.

(and (or (acl2-numberp x)
         (characterp x)
         (stringp x)
         (symbolp x))
     (state-p1 state-state)
     (symbolp channel)
     (open-output-channel-p1 channel :character state-state))

See fmt for more sophisticated printing routines, and see io for general information about input and output.

Subtopics

Std/io/princ$
Print an atom to a :character output stream.
Newline
Print a newline to a given output channel