[plt-scheme] directory-list order?

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Sep 13 15:51:19 EDT 2006

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!


Posted on the users mailing list.