[Date Prev][Date Next][Thread Prev][Thread Next]
[Search]
[Date Index]
[Thread Index]
[MacPerl] Schwartzian transform
>
>>Maybe Schwartzian Transform is cool and maybe it isn't, but it
>>doesn't seem likely to put any more money in your pocket in either
>>case.
It's not a question of cool. It's a question of efficient, and a good way
to do things, and whether it works. It's also a question of idioms.
FYI, here's the description of the Schwartzian Transform from Mark-Jason
Dominus' Perl Paraphernalia pages:
The problem it solves is when you want to sort a list of items, not by
some apparent feature of the items, but by some hidden feature. For
example, you have a list of the files in the current directory, and you
want to sort them by modification date instead of by name.
The general idea is this: Construct a data structure that has both kinds
of information, names and dates in it, sort by the appropriate one, and
then throw it away again.
See
http://www.plover.com/~mjd/perl/TPC/1998/Hardware-notes.html#Schwartzian_Tra
nsform
for more details and examples
Here, we're sorting a list of names by... name. And we want to keep all
the data when we're finished. I'm not sure that the S.T. is, therefore,
entirely appropriate.
I could be mistaken :-)
-- --
|\ _,,,---,,_ Vicki Brown <vlb@cfcl.com>
ZZZzz /,`.-'`' -. ;-;;,_ Journeyman Sourceror: Scripts & Philtres
|,4- ) )-,_. ,\ ( `'-' P.O. Box 1269 San Bruno CA 94066
'---''(_/--' `-'\_) http://www.cfcl.com/~vlb http://www.macperl.org
===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org