2010/6/25 Rob Antonishen <rob.antonis...@gmail.com>: > > Add in a merge sort (i used these three functions): > > (define split > (lambda (ls) > ... > (split-h ls ls '())))) > > (define merge > (lambda (pred ls1 ls2) > ... > (else (cons (car ls2) (merge pred ls1 (cdr ls2))))))) > > (define merge-sort > (lambda (pred ls) > ... > (merge-sort pred (cdr splits)))))))) > > Then get a sorted directory like like so: > (set! varFileList (merge-sort string<=? (cadr (file-glob > (string-append varDirectory DIR-SEPARATOR "*") 1)))) > > -Rob A> >
Well done, Rob, and what an interesting revelation! Though not so long ago, indeed, I have collected all the Script-Fu procedures returned by the “oblist” command invocation in a text file, with the purpose of having them always within reach, nevertheless I hadn’t noticed the existence of the “file-glob” procedure before now. Hence, thanks a lot for highlighting this command, as well as for contriving those powerful procedures whereby it is possible to achieve a sorted directory. The approach you suggest is a good alternative to the employment of the “dir-read-entry” procedure, which actually might be unreliable in certain cases, as Saulgoode points out, depending to what kind of filesystem the target directory belongs to. In fact, after obtaining an alphabetically ordered list with the names of the folder's elements, it would be possible to exploit even the last element rather than the first one, by producing a new string that concatenates this ending string, the character “z”, and finally the string “.pat”, so as to get a file name that should be unique and non-confrontational. Thank you again for your contribution. _______________________________________________ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer