Paste: last-modified

Author: trevor
Mode: factor
Date: Sat, 5 Feb 2011 01:25:58
Plain Text |
: last-modified ( path -- path )
    dup
    [
        dup [ file-info modified>> ] map zip
    ] with-directory-files
    sort-values last first "/" prepend append ;

Annotation: factored

Author: trevor
Mode: factor
Date: Sat, 5 Feb 2011 02:06:12
Plain Text |
: modification-times ( path -- assoc )
    [
        dup [ file-info modified>> ] map zip
    ] with-directory-files ;

: last-modified ( path -- path )
    dup modification-times sort-values last first append-path ;

Annotation: use preserving combinator

Author: _phred
Mode: factor
Date: Sat, 5 Feb 2011 02:46:46
Plain Text |
: modification-times ( path -- assoc )
    [
        dup [ file-info modified>> ] map zip
    ] with-directory-files ;

: last-modified ( path -- path )
    [ modification-times sort-values last first ] keep swap append-path ;

Annotation: use map>assoc

Author: _phred
Mode: factor
Date: Sat, 5 Feb 2011 03:40:57
Plain Text |
: modification-times ( path -- assoc )
   [ [ dup file-info modified>> ] { } map>assoc ] with-directory-files ;

: last-modified ( path -- path )
    [ modification-times sort-values last first ] keep swap append-path ;

New Annotation

Summary:
Author:
Mode:
Body: