• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
          • Fmt
          • Msg
          • Cw
          • Set-evisc-tuple
          • Set-iprint
          • Print-control
          • Read-file-into-string
          • Std/io
          • Msgp
          • Printing-to-strings
          • Evisc-tuple
          • Output-controls
          • Observation
          • *standard-co*
          • Ppr-special-syms
          • Standard-oi
          • Standard-co
          • Without-evisc
          • Serialize
          • Output-to-file
          • Fmt-to-comment-window
          • Princ$
            • Std/io/princ$
            • Newline
          • Character-encoding
          • Open-output-channel!
          • Cw-print-base-radix
          • Set-print-case
          • Set-print-base
          • Print-object$
          • Extend-pathname
          • Print-object$+
          • Fmx-cw
          • Set-print-radix
          • Set-fmt-hard-right-margin
          • File-write-date$
          • Proofs-co
          • Set-print-base-radix
          • Print-base-p
          • *standard-oi*
          • Wof
          • File-length$
          • Fms!-lst
          • Delete-file$
          • *standard-ci*
          • Write-list
          • Trace-co
          • Fmt!
          • Fms
          • 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
          • Fmx
          • Cw!+
          • Read-objects-from-book
          • Newline
          • Cw+
          • Probe-file
          • Write-objects-to-file!
          • Write-objects-to-file
          • Read-objects-from-file
          • Read-object-from-file
          • Read-file-into-byte-list
          • Set-fmt-soft-right-margin
          • Read-file-into-character-list
          • Io-utilities
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defmacro
        • Loop$-primer
        • Fast-alists
        • Defconst
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
        • Efficiency
        • Irrelevant-formals
        • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
        • Redefining-programs
        • Lists
        • Invariant-risk
        • Errors
        • Defabbrev
        • Conses
        • Alists
        • Set-register-invariant-risk
        • Strings
        • Program-wrapper
        • Get-internal-time
        • Basics
        • Packages
        • Oracle-eval
        • Defmacro-untouchable
        • <<
        • Primitive
        • Revert-world
        • Unmemoize
        • Set-duplicate-keys-action
        • Symbols
        • Def-list-constructor
        • Easy-simplify-term
        • Defiteration
        • Fake-oracle-eval
        • Defopen
        • Sleep
      • Operational-semantics
      • Real
      • Start-here
      • Debugging
      • Miscellaneous
      • Output-controls
      • Macros
      • Interfacing-tools
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • 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