Hello,
How can I print a single backslash in SBCL? I mean, the expression:
(format nil "\\")
returns "\\" and not "\". If I type a single backslash, as can be expected, it is interpreted as an escape character for the following element in the string.
Does someone know how to solve this problem in SBCL?
Thanks in advance.
Luis.
printing a backslash
Re: printing a backslash
Hello again:
I just have solved my problem. Although 2 characters are printed, the string created contains a single backslash.
Regards,
Luis.
I just have solved my problem. Although 2 characters are printed, the string created contains a single backslash.
Regards,
Luis.
Re: printing a backslash
Values in Common Lisp can be printed readably or not, where the readability applies to the CL reader, which reads symbolic expression according to CL syntax. Since backslash is an escape character it has to be escaped when printed readably. Return values in the REPL are usually printed readably.
Compare:
The first line is the output of printing operator, the second output of the P part of REPL.
Compare:
Code: Select all
CL-USER> (print "\\")
"\\"
"\\"
CL-USER> (princ "\\")
\
"\\"
Re: printing a backslash
Hello,
Thank you very much for the explanation. Now, it is perfectly clear.
Regards,
Luis.
Thank you very much for the explanation. Now, it is perfectly clear.
Regards,
Luis.