使用CCL时,当我使用,例如,(format t "~s" pathname)或使用pprint或使用,打印路径名时print,它会使用#P阅读器语法打印出来.例如:
? (make-pathname :directory "foo")
#P"foo/"
? (format t "~s" (make-pathname :directory "foo"))
#P"foo/"
NIL
Run Code Online (Sandbox Code Playgroud)
我真的很想看到底层的路径名结构,这样我就可以准确地说出对象的样子.有没有办法打印原始?
我不知道你是否正在寻找,但你可以打电话给检查员
(inspect thing)
Run Code Online (Sandbox Code Playgroud)
CCL示例:
? (inspect (make-pathname :directory "foo"))
[0] #P"foo/"
[1] Type: PATHNAME
[2] Class: #<BUILT-IN-CLASS PATHNAME>
[3] TYPE: (PATHNAME . #<CCL::CLASS-WRAPPER PATHNAME #x14083886>)
[4] %PATHNAME-DIRECTORY: (:RELATIVE "foo")
[5] %PATHNAME-NAME: NIL
[6] %PATHNAME-TYPE: NIL
[7] %PHYSICAL-PATHNAME-VERSION: NIL
[8] %PHYSICAL-PATHNAME-DEVICE: NIL
Inspect> help
The following toplevel commands are available:
<n> the same as (:I <n>)
(:S N V) set the <n>th line of object data to value <v>
:HOME show first page of object data
:PREV show previous page of object data
:NEXT show next page of object data
:SHOW re-show currently inspected object (the value of CCL:@)
:Q exit inspector
:POP exit current inspector level
(:I N) inspect <n>th item
:? help
:PWD Print the pathame of the current directory
(:CD DIR) Change to directory DIR (e.g., #p"ccl:" or "/some/dir")
(:PROC &OPTIONAL P) Show information about specified process <p>/all processes
(:KILL P) Kill process whose name or ID matches <p>
(:Y &OPTIONAL P) Yield control of terminal-input to process
whose name or ID matches <p>, or to any process if <p> is null
Any other form is evaluated and its results are printed out.
Inspect>
Run Code Online (Sandbox Code Playgroud)
除此之外inspect,您还可以使用describe:
? (describe #P"/tmp/**/file.*")
#P"/tmp/**/file.*"
Type: PATHNAME
Class: #<BUILT-IN-CLASS PATHNAME>
TYPE: (PATHNAME . #<CCL::CLASS-WRAPPER PATHNAME #x30004003ED0D>)
%PATHNAME-DIRECTORY: (:ABSOLUTE "tmp" :WILD-INFERIORS)
%PATHNAME-NAME: "file"
%PATHNAME-TYPE: :WILD
%PHYSICAL-PATHNAME-VERSION: :NEWEST
%PHYSICAL-PATHNAME-DEVICE: NIL
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
93 次 |
| 最近记录: |