问题描述
我一直在尝试查看CLISP目录中的所有文件的列表,但我只能在目录中获取所有非目录文件。
我正在Windows 7中使用cygwin尝试这样做,这可能会影响我的结果。我对CLISP(和所有的LISP)都很新,我目前正在尝试的是如下:
(目录(make-pathname:directory
pre>
'(:absolutecygdrivecDownload)
:name:wild))
成功返回C:\Download中的所有非目录文件,但不返回目录,我搜索全部,全部常见的Lisp参考指向使用目录,但似乎不可能,我没有Common Lisp(或CLISP只是可能?)的方式来解决目录中的所有文件。
解决方案请参阅CLISP实现说明,:
如果你想要当前目录中的所有文件和子目录,您应该使用
(NCONC(DIRECTORY* /)(DIRECTORY*))
。I've been trying to see get a list of all files within a directory in CLISP, but I've only been able to get all non-directory files within a directory.
I'm currently trying this in Windows 7 with cygwin, so that may influence my results. I'm pretty new to CLISP (and LISP over all), and what I'm currently trying to do is as follows:
(directory (make-pathname :directory '(:absolute "cygdrive" "c" "Download") :name :wild))
This successfully returns all non-directory files within "C:\Download. However, it doesn't return directories. I've searched all over, and all Common Lisp references point to using "directory", but it seems impossible to me that there is no Common Lisp (or CLISP only perhaps?) way to address all files within a directory.
Any help would be appreciated. Thanks in advance!
解决方案See the CLISP implementation notes, section 20.3.2:
"If you want all the files and subdirectories in the current directory, you should use
(NCONC (DIRECTORY "*/") (DIRECTORY "*"))
."这篇关于列出CLISP中的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!