chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] alternative name for `find-files'


From: Peter Bex
Subject: Re: [Chicken-hackers] alternative name for `find-files'
Date: Sun, 4 Jul 2010 12:47:40 +0200
User-agent: Mutt/1.4.2.3i

On Sun, Jul 04, 2010 at 11:45:19AM +0200, Peter Bex wrote:
> That's a hard one. find-files is the perfect name for this procedure :(
> Maybe DIRECTORY-FILTER, as it's like a (recursive) version of DIRECTORY
> but with a filtered result set?

I did a quick tour of the other major Schemes and was horrified to see
how underpowered the bulk of them are; many schemes didn't even have
such a procedure!  I found the following:

Gauche has DIRECTORY-FOLD which is similar (but with a lot less options)
I like this better than DIRECTORY-FILTER because our FIND-FILES also
accepts an optional folding procedure which defaults to CONS.  If it were
merely a filtering procedure it wouldn't allow that.
Chibi also has DIRECTORY-FOLD.

SCSH has FILE-MATCH, which is pretty different but like the docs say:
"file-match provides a more powerful file-matching service, at the
 expense of a less convenient notation. It is intermediate in power
 between most shell matching machinery and recursive find(1)."

"Racket" has FIND-FILES and FOLD-FILES.  I don't like the naming
convention.  We have STRING-FOLD and VECTOR-FOLD, not FOLD-STRING and
FOLD-VECTOR.  But FILE-FIND and FILE-FOLD could be acceptable I guess.

Guile has FTW, which is a horrible C-inspired name, but I think it
stands for FILE-TREE-WALK which is an acceptable name.  Alternatively,
FILE-TREE-SEARCH (taken from the newer fts(3) POSIX interface).
WALK could also be replaced by TRAVERSE.

Of these, I really like DIRECTORY-FOLD most, and I think if we were to
use it we should aim for compatibility with these two Schemes.
I think this is possible. The signatures are
(directory-fold path proc seed #!key lister follow-link?) for Gauche
and (directory-fold dir kons knil) for Chibi.
I think if Chicken has at least the same three initial positional
arguments, the simplest usages of this procedure would be portable
between these three Schemes.  All other options could be keyword args,
possibly overlapping with those of Gauche.
Taylor Campbell also made a proposal that is equivalent to Chibi AFAICT:
http://mumble.net/~campbell/proposals/filesys.text

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth



reply via email to

[Prev in Thread] Current Thread [Next in Thread]