From: Ville V. <vil...@gm...> - 2008-08-20 21:07:20
|
On Wed, Aug 20, 2008 at 10:47 PM, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX wrote: First of all, thanks for the advice, it's always nice to have this kind of help. Then to the rebuttals. :) > Regarding both WILD and NON-WILD, I don't believe the AND operator is guaranteed > to return the last element, so, best would be to use IF instead of OR, testing > the FIRST-WILD condition as the IF test. The hyperspec (http://www.lispworks.com/documentation/HyperSpec/Body/m_and.htm) disagrees. It claims that the (result of the) last form is returned. About consing: I wanted to get the algorithm to work, performance was secondary. I am aware of destructive functions (nconc et al) but I chose to avoid them for the time being. I'd really like to have profiling data before I start worrying about append vs. nconc, for example. Even more so since this is an i/o operation. I'm not against optimizing it, even if just for not bogging the cpu too much - I just doubt whether the whole runtime of directory listing is affected much by consing. > To that extent, it uses NCONC: the destructive cousin of APPEND. > APPEND creates a copy > of all the lists it's being passed. So, for the same reason as the one Not all of them, I suppose - append is permitted to not copy the last list given to it. > I have a question: does your code *only* expand the directories at > higher levels, or > does it also expand the files there? If it also expands the files > (only to be removed > later because they don't match), this too may be done more efficiently > - reducing the > need to instantiate objects. I assume that by higher levels you mean subdirectories? Yes, the code expands files - the list-directory function just returns empty set of entries for those. I decided to avoid filtering out non-directories, since this was really not an attempt to make a perfect patch, just to get the wildcard listing to work with reasonable (read: very little) effort. I don't mind the improvement suggestions, though. I'm also not at all surprised that there are improvement ideas since I really did not strive for perfection. I suppose it's actually quite easy to filter out files by using the pathname functions, it's just that I'm not very familiar with lisp pathname stuff and I decided to push the patch as soon as I got it working. > Do you want to look at my code and integrate both solutions into a single patch? I can give it a shot. I'll likely have some questions about your code along the way, but I'll try creating some sort of synthesis-patch. :) later, -VJV- |