Python有:
"""
line1
line2
line3
"""
Run Code Online (Sandbox Code Playgroud)
我怎么能在Common Lisp中做到这一点?
这只是一个常规字符串:
"
line1
line2
line3
"
Run Code Online (Sandbox Code Playgroud)
但是,您需要转义内部双引号字符.
如果您不想转义引号,则必须更改可读表.实际上,您可以通过使用cl-interpol库轻松获得所需的行为(以及更多),该库定义了字符串的自定义语法,特别是不同类型的外部分隔符.
CL-USER> (ql:quickload :cl-interpol)
...
CL-USER> (interpol:enable-interpol-syntax)
; No value
CL-USER> #?(some string)
"some string"
CL-USER> #?(some string with a "string" inside)
"some string with a \"string\" inside"
CL-USER> #?(some string with (nested (parentheses)))
"some string with (nested (parentheses))"
Run Code Online (Sandbox Code Playgroud)