简体   繁体   中英

Clozure Common Lisp - file-exists-p is undefined

I get a "Undefined function FILE-EXISTS-P called with arguments ..." error when calling (file-exists-p "somepath") in Clozure Common Lisp but everywhere I look it appears that this function should be available. I even see it when using Mx apropos.

I'm using LispBox for Windows.

Does anyone have an idea of what might be wrong or maybe suggest a process by which I can try to figure it out?

FILE-EXISTS-P is not a standard Common Lisp function or a Clozure Common Lisp specific function.

Instead, you can use the standard PROBE-FILE function (see the manual ) to check if a file exists:

CL-USER> (probe-file "not-existant-file.lisp")
NIL
CL-USER> (probe-file "/Users/myname/temp.lisp")
#P"/Users/myname/temp.lisp"

Note that the in the standard is undefined the result of applying the function to a directory, while the CCL implementation (at least on some systems) checks correctly also if a directory exists:

CL-USER> (probe-file "/Users/myname/")
#P"/Users/myname/"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM