Attached is a patch that I believe ANSIfies our version of DIRECTORY.
The only change (apart from cosmetic changes) is to make
return #P"/tmp/" (i.e. a pathname with :DIRECTORY '(:ABSOLUTE "tmp") and
With this, I believe that we will be compliant with ANSI in our
DIRECTORY, PATHNAME-MATCH-P and WILD-PATHNAME-P.
That said, this bold assertion depends slightly on my interpretation of
the standard, which I will attempt to lay out before you; this being a
pathnames topic, please forgive me if it doesn't seem totally logical.
The first thing I'd like to address is the assertion that
PATHNAME-MATCH-P and DIRECTORY must agree -- see the CLHS page for
PATHNAME-MATCH-P, where it says:
pathname-match-p returns true if pathname matches wildcard, otherwise
nil. The matching rules are implementation-defined but should be
consistent with directory. Missing components of wildcard default to
In particular, what I would like to assert is that, though the matching
rules must be consistent with DIRECTORY, there is no requirement that
DIRECTORY default missing components of its argument to :WILD. Thus,
according to this, there is no requirement that (DIRECTORY #P"/") give a
list of all files in the root directory.
[ This latter point may have some relevance to a thread on cll and
cmucl-imp recently. ]
This interpretation allows us to fulfil the expectation of
WILD-PATHNAME-P and DIRECTORY, also; from the (non-normative) Notes
section in the CLHS page for DIRECTORY:
If the pathspec is not wild, the resulting list will contain either
zero or one elements.
With this patch (and indeed before) (WILD-PATHNAME-P #P"/") will return
NIL, and (DIRECTORY #P"/") will return the list (#P"/").
So what does this patch actually do? Well, it ensures that DIRECTORY is
compliant in returning TRUENAMEs of its pathnames. I wanted to preserve
the return values of DIRECTORY including directories [ e.g. (DIRECTORY
"/tmp") returning (#P"/tmp/") ], as this seems to be the only way of
allowing conforming programs to walk the directory structure. It is
therefore necessary to cause (TRUENAME "/tmp") to return #P"/tmp/". I
couldn't see a reason not to do this, so I've done it; but maybe there
is a problem that I've overlooked?
 To get the list of all files in the root directory,
is portable and, I'd maintain, required for conforming code (modulo
perverse namestring parsing which would require MAKE-PATHNAME
http://www-jcsu.jesus.cam.ac.uk/~csr21/ +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%") (pprint #36rJesusCollegeCambridge)