[plt-scheme] directory-list order?
On Sep 13, Eli Barzilay wrote:
>
> 3. For stuff like that it can be better to cache the FS operations
> so you do only a linear number of them:
>
> (define (read-directory)
> (map cdr
> (sort (map (lambda (p)
> (cons (file-or-directory-modify-seconds p) p))
> (directory-list))
> (lambda (p q) (< (car p) (car q))))))
>
> IIRC, in Ruby this hack even has a name (which I don't remember)
> and its own syntactic construct.
I asked -- the term actually comes from Perl, and adopted by Ruby as a
method that programmers need to implement. It is a "Schwartzian
Transform". The wikipedia page on this actualy has the same
example...
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!