This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
jimb@red-bean.com writes: > > > How would the guile version have looked if the following procedures where > > available in some library? BTW, I agree that stuff like this should exist > > somewhere in the guile tree. > > A library could have eliminated about a page, but not so much. > > > (define (find-files dir . arg-ls) > > "Return a list of files within directory DIR. Two optional arguements > > are supported, PREDICATE and RECURSE?. PREDICATE should be a procedure > > of one argument that determines whether a particular file should be included > > in the returned list. As a special case, if PREDICATE is a string, it is > > compiled into a regular expression, and a predicate is generated that applies > > this regular expression to the filename. RECURSE? determines whether the > > procedure descends into subdirectories, and it defaults to #t. Symbolic > > links are not followed." > > I like the bit about how a string supplied as a predicate > automatically turns into a regexp. That might be a good convention to > use more widely, whenever one supplies a predicate on strings. If the > context says the predicate will be applied to filenames, it should be > a glob pattern. If the context just says it'll be applied to strings, > it should be a full regexp. I like this too. I've tried to use the same convention in scwm whenever appropriate. - Maciej