Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Understanding the Schwartzian transform.

by rjt (Deacon)
on Jul 22, 2013 at 06:47 UTC ( #1045602=note: print w/ replies, xml ) Need Help??


in reply to Understanding the Schwartzian transform.

In English, from right to left (bottom up, in this case): read list of file names in directory. Store each name in an array ref containing the filename, and its modification time. Take that new list, and sort it in descending order based on a custom sort sub that does a numerical compare on the 2nd element of the array ref (I.e., the modification time). Finally, take that now-sorted list of array refs and map each ref back to the filename by extracting the first element (remember arrays are 0-based). The result is stored in @sorted_names. Try breaking that up into its components and printing out the result of each step if you're still unsteady on the details. Hope this helps.


Comment on Re: Understanding the Schwartzian transform.
Download Code
Re^2: Understanding the Schwartzian transform.
by Anonymous Monk on Jul 22, 2013 at 06:59 UTC
    ...and its associated size in bytes
    s/associated size in bytes/modification time/;


    Excellent. Thanks all for the help. Is this the canonical form of the Schwartzian Transform or a variant?

      Is this the canonical form of the Schwartzian Transform or a variant?

      Yes, it can be considered as the canonical form of the Schwartzian Transform. The original ST that appeared in a newsgroup more than 15 years ago might not have worked on fila age (I don't remember), but, definitely, the "output_array = map {block} sort {block} map {block} input array" is the canonical form of the Schwartzian Transform.

        but, definitely, the "output_array = map {block} sort {block} map {block} input array" is the canonical for of the Schwartzian Transform.

        Sorry, that is like the generic form of Guttman-Rosler Transforms (see links) except without the secret ingredient :)(normalize/restore)

        Schwartzian is

        my @sorted = map { restore_from_cache } sort { by_cached_expensive } map { store_cache_expensive } @original;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045602]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-12-28 20:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls