[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] Ballot item #113 "directory contents"
- To: Alex Shinn <alexshinn@x>
- Subject: Re: [Scheme-reports] Ballot item #113 "directory contents"
- From: Aubrey Jaffer <agj@x>
- Date: Thu, 13 Jan 2011 17:30:53 -0500 (EST)
- Cc: scheme-reports@x
- In-reply-to: <AANLkTi=THByNNJ=89=voRhLgrpj2vbWYuHEZdSC+AM46@mail.gmail.com> (message from Alex Shinn on Tue, 11 Jan 2011 23:36:05 +0900)
- References: <firstname.lastname@example.org> <AANLkTi=THByNNJ=89=voRhLgrpj2vbWYuHEZdSC+AM46@mail.gmail.com>
| Date: Tue, 11 Jan 2011 23:36:05 +0900
| From: Alex Shinn <alexshinn@x>
| On Tue, Jan 11, 2011 at 9:30 PM, pod <pod@x> wrote:
| > Please forgive my interjections but I couldn't help noticing that
| > the current ballot item #113 "directory contents" seems rather
| > lacking in detail and does not got far enough in providing
| > functionality necessary for "a large class of scripts". The info
| > paragraph for this items reads:
| > We've decided to add file-exists? and delete-file, essential
| > for a large class of scripts, but still have no way to get a
| > list of files in a directory. Do we want to provide an
| > interface to this?
SLIB has had "file-exists?" and "delete-file" for all supported
implementations since 1993.
Integrated circuit designs can have thousands of files in a directory.
Fetching the complete list of files can take significant time.
Although SCM provides the Posix functions "opendir", "readdir",
"rewinddir", and "closedir", AFAICR I have never used them directly;
"directory-for-each" provides all the directory functionality I have
-- Function: directory-for-each proc directory
PROC must be a procedure taking one argument.
`Directory-For-Each' applies PROC to the (string) name of each
file in DIRECTORY. The dynamic order in which PROC is applied to
the filenames is unspecified. The value returned by
`directory-for-each' is unspecified.
-- Function: directory-for-each proc directory pred
Applies PROC only to those filenames for which the procedure PRED
returns a non-false value.
-- Function: directory-for-each proc directory match
Applies PROC only to those filenames for which
`(filename:match?? MATCH)' would return a non-false value
(*note Filenames: (slib)Filenames.).
(directory-for-each print "." "[A-Z]*.scm")
Because the name predicate (pred) and match string are applied only to
filenames in the directory, they are insensitive to path separators.
| One of the rationales in the first ballot pointed out that
| just adding file-exists? and delete-file was silly.
I have written many SCM scripts. File paths are typically passed as
command-line arguments. Nearly all use "file-exists?". Some use
"delete-file" (mosthly on temporary files). Only a few use
So no, just adding file-exists? and delete-file is not silly.
Scheme-reports mailing list