[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: find for guile
From: |
Jorgen 'forcer' Schaefer |
Subject: |
Re: find for guile |
Date: |
06 Oct 2000 18:24:06 +0200 |
User-agent: |
Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7 |
Marco Maggesi <address@hidden> writes:
> I started to write a `find' procedure for guile.
Great!
> I wonder if it would be more appropriate to implement the
> function `glob' in C or in Scheme. Any suggestion?
There's fnmatch(3) and glob(3), both conforming to POSIX.2, maybe
you want to check them (or at least the glibc implementation)
out.
Glob in C would be faster, and since you could use fnmatch if
it's provided, easier to implement.
> I also would like to propose an extension to accept lists
> (to mean `or' instead of `and') as argument to `find' as in
> the following example:
I don't think this is a good idea, it confuses more than it
cleans up, IMHO.
> (find "."
> regular? ; skip links and directory
> '("*~" "*.BAK" empty?)
> delete-file)
(find "."
regular?
(or "*~" "*.BAK" empty?)
delete-file)
would be much "cleaner" in my opinion. Also, this can be used
for nesting much cleaner:
(find "."
regular?
(or (and "*~" (not orig-exists?))
empty?)
delete-file)
(orig-exists? would check wether the original file exists (file
without ~), so this whole thing would delete empty files or
backup files for which there's no original file.)
This way, the arguments to find meaning "and" is a special
exception.
By the way, so that the arguments to find can mean "and", you
have to make find a special form anyways (using define-syntax),
so you can scratch the quote there :)
Also, it would be nice if there'd be a way that find would return
a list of results ...
I'm pretty green too, so don't take my words as The Right Thing.
I'm sure others will comment as well.
-- jorgen
--
((email . "address@hidden") (www . "http://forcix.cx/")
(irc . "address@hidden (IRCnet)") (gpg . "1024D/028AF63C"))
- find for guile, Marco Maggesi, 2000/10/06
- Re: find for guile,
Jorgen 'forcer' Schaefer <=