Function Entry: PRIN1
← Prev | ↑ Chapter | Next → | Index | Symbols
Function Entry: PRIN1
Name
prin1
Class
Function
Syntax
(prin1 [expression [fileHandle]])
Arguments and Values
expression(optional): any AutoLISP expression or value. If omitted, nil is used.fileHandle(optional): handle of a file as obtained from(open …). If omitted or nil, output goes to the command line.
Description
Prints expression to the command line, or writes it to the open file fileHandle. The representation is machine-readable: control characters in a string expression (\t, \n, \r, the escaped double-quote, octal \nnn) are written as their backslash escape sequences so that the output round-trips through the reader.
Return Values
Returns the evaluated value of expression. With no argument, (prin1) returns the void symbol value, useful as the last form in a defun to emit "nothing" to the command line.
Side Effects
Writes the printed representation to the command line or to fileHandle.
Examples
With (setq x 123):
(prin1 x)prints123to the command line and returns123.(prin1 x fh)writes123to file handlefhand returns123.
Tested Behaviour (BricsCAD V26 / macOS, 2026-04-26)
(prin1 "hello" file-desc) returns "hello" and writes the seven characters "hello" (the literal seven, including the surrounding double quotes — i.e. the round-trippable representation) to the file. The 2-argument form is fully accepted by BricsCAD V26.
Availability
- AutoCAD 2026: documented (Autodesk reference page).
- BricsCAD V26: documented + product-tested on macOS (probe suite, 2026-04-26). 2-argument form accepted; output is round-trippable.
- Status: documented in both vendors and tested against BricsCAD V26 / macOS.
See Also
- probe-output.lsp — executable Phase-5 probe suite for the printer surface.
- probe results, BricsCAD V26 / macOS, 2026-04-26.
princfor display-oriented output (no escape rewriting).printfor the bracketed prin1 + leading newline + trailing space form.
Source Notes
- [prin1 (AutoLISP 2026)](https://help.autodesk.com/cloudhelp/2026/ENU/AutoCAD-AutoLISP-Reference/files/GUID-BF4CEE45-BB6F-443B-A588-A40D9BCE378F.htm)
- [prin1 (BricsCAD V26 DevRef)](https://developer.bricsys.com/bricscad/help/en_US/V26/DevRef/source/prin1.htm)
- Status: documented and product-tested (Phase 5 closure).
Measured: how a real prints
Measured 2026-10-25 (probe-versions; AutoCAD 2022 job 17450478986, BricsCAD
V26 macOS 17450478987, V25 Windows 17450350668), the same for prin1,
princ, vl-prin1-to-string and vl-princ-to-string:
| value | AutoCAD 2022 | BricsCAD V25 / V26 |
|---|---|---|
| 1/3 | 0.333333 | 0.333333333333333 |
| 123.456 | 123.456 | 123.456 |
| 100.0 | 100.0 | 100.0 |
| 1.0e6 | 1.0e+06 | 1000000.0 |
| 12345678.0 | 1.23457e+07 | 12345678.0 |
| 1.0e15 | 1.0e+15 | 1e+15 |
| 1.0e-5 | 1.0e-05 | 1e-05 |
| 1.0e-20 | 1.0e-20 | 1e-20 |
| -2.5e30 | -2.5e+30 | -2.5e+30 |
AutoCAD writes C's %.6g (six significant digits) with a point always in
the mantissa; BricsCAD %.15g with .0 added when there is neither a point
nor an exponent. The exponent is signed, with at least two digits, on both.
BricsCAD V18.1's release note "tiny doubles print 0.0" is not what V25 / V26
do.
clautolisp: how a real prints
The AutoCAD dialects print a real as AutoCAD does, the BricsCAD dialects as
BricsCAD does; clautolisp, strict and lax keep clautolisp's own
spelling, which shows the shortest digits that read back to the same value
(0.3333333333333333, 1000000.0, 1.2345678e7, 1.0e-5). Neither
vendor's choice follows from a format specifier, so the first time a real
the two products spell differently is printed, every dialect but lax
prints a [real-format] notice – once per session. rtos (with an explicit
precision) is the portable way to print a real; rtos and command tokens
keep the full value under every dialect.
Tested Behaviour (sunset campaign B3, 2026-10-28)
probe-reader-printer.lsp; AutoCAD 2022 job 17540963671, BricsCAD V25 Windows 17540963675, BricsCAD V26 macOS 17540963672. PRIN1 of a string escapes a control character – tab, newline, return and escape by name (\t \n \r \e), the others in three octal digits (code 7: \007) – on both products; DEL (127) as \177 on AutoCAD, as itself on BricsCAD; READ gives the string back. A character the CAD's code page (LISPSYS 0) cannot hold prints as that page maps it (AutoCAD: the euro as code 172, an astral character as \000; BricsCAD Windows: 128 and 62976).
clautolisp (2.3.76): the same escapes; DEL as the dialect's product does; characters print as themselves (no code page).
clautolisp: an explicit NIL file
clautolisp implementation deviation – not part of the normative
specification above. (prin1 x nil) follows the same per-dialect rule as
princ (see its "Tested Behaviour (explicit NIL file)" and "clautolisp: an
explicit NIL file"): an error and a [printer-nil-file] warning under
--dialect autocad, as AutoCAD 2022 does; output to the command line,
warned under --strict, silent under the other dialects.