There is no predefined function to convert either a list or a symbol to a string. But we can create on using an inverse (read) function that converts data of any type to a string. Noting that (princ) will write any data type to a file, and that (read-line) returns a string, we can use a temporary file for conversion.
(defun XTOS (ARG / FILE)
(setq FILE (open “$temp” “w”))
(princ ARG FILE)
(setq FILE (open “$temp” “r”))
(setq ARG (read-line FILE))
Command: (setq PT1 (list 1.0 3.0 0.0))
(1.0 3.0 0.0)
Command: (xtos PT1)
“(1.0 3.0 0.0)”
Command: (strcat “\nThis is a list of points: ” (xtos PT1))
“\nThis is a list of points: (1.0 3.0 0.0)”
- A complete solution to this exercise is on your class disk as XTOS-A.LSP.