Major Section: ACL2-BUILT-INS
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, see set-print-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) <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.