(prin1 [expression [file-descriptor]])
Print it exactly the way it looks.
This function prints data to the screen or to a file. When a file-descriptor is provided, LISP prints to a file; when the file-descriptor is missing, LISP prints to the progeCAD Prompt History window.
When you are printing to a file, the file must previously have been opened with the open function in write "w" or append "a" mode.
The argument expression represents the expression to be printed. It can be any expression, not just a string. Only the expression is printed, no new line or space is included.
The prin1 function can be used with no arguments to return a null string, in which case an empty file is printed.
Examples
Code | Prints | Returns |
---|---|---|
(setq v1 222) | ||
(prin1 v1) | 222 | 222 |
(prin1 'v1) | V1 | V1 |
(prin1 "Thank You") | "Thank you" | "Thank you" |
(prin1 "Sample" f) | "Sample"(to file f) | "Sample" |
(prin1 "\nName:") | "\nName:" | "\nName:" |
NOTES
- Use the prin1 function at the end of
a LISP routine to suppress the display of nil when the routine finishes
running:
(prin1) - The difference between the prin1 function and LISP's other print-related functions (for example, princ and print) is that prin1 treats control characters literally.
- progeCAD does not support Unicode.
Tell me about...
(setq symbol1 statement1 [symbol2 statement2] ...)