std-princ | ![]() |
std-princ is a workaround for not being able to define optional arguments in AutoLISP alone. It prints every element in a list and any not list arguments with princ.
It is used to print lists of variable argument types, which are difficult to concatenate with strcat, in a user-friendly format to the console.
In comparison (PRIN1) is used to print in a format suitable to (READ)
It prints all elements in the list with STD-%WRITE without a space between the elements and without surrounding brackets.
In addition it honors the global variables *PRINT-LENGTH* and *PRINT-LEVEL* for each element in the list and all subelements within the list to shorten the output for large or deeply nested lists. But only for list elements in the first level list, not for lists on the first level.
So if you want long lists to be splitted put them inside the (LIST) function, to print them like with princ you have to reset *PRINT-LENGTH* and *PRINT-LEVEL* to nil and use the list argument inside the (LIST) function.
In the small package std-princ is the same as princ, so lists are printed as lists and not as consecutive elements.
(std-princ "test") (std-princ (list "A number: " i " and another unknown: " lst)) (setq *PRINT-LENGTH* 10)
(std-princ (list (std-int-list 1000)))
prints: (0 1 2 3 4 5 6 7 8 9 ...)
but:
(std-princ (std-int-list 1000))
prints all 1000 numbers without spaces in between and without surrounding brackets.
and:
(setq *PRINT-LENGTH* nil *PRINT-LEVEL* nil)
(std-princ (list (std-int-list 1000)))
same as with (princ (std-int-list 1000))
This will print 1000 as list structure.
msg: any valid lisp expression. Most likely a list of to be printed expressions.
Not defined. Most likely NIL.
Prints a string to the console. This is a typical function only used for its side effect.
(std-require 'STDLISP)
Defined in STDLISP
Affected by #- SMALL