Tenses The Present Simple Tense The Future Simple Tense The Past Simple Tense.
The Surprisingly Tense History of the Schwartzian Transform
-
Upload
brian-d-foy -
Category
Technology
-
view
1.007 -
download
0
Transcript of The Surprisingly Tense History of the Schwartzian Transform
Alpine Perl Workshop 2016 • brian d foy
The Surprisingly Tense History of the
Schwartzian Transform
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
http://bit.ly/2bHNNx4
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
Randal Schwartz
Just another
hacker.
• troff• emacs•Lisp•Perl•Smalltalk•…
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
Tom Christiansen
• Languages geek • Csh god• Perl evangelist
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform The Technique
Its ExpressionThe Arguments
Its NameThe Reckoning
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
decoratesort
undecorate
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
computeassociate
sortmap
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
Richard Stallman
• Editor editor• GNU• Free Software
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
TECO - Text Editor and CorrectorEmacs - Editing MACroS EINE - E. Is Not Emacs
ZWEI - Z. Was EINE InitiallyGNU Emacs
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform Lisp
(defun schwartzian-transform (list costly-function predicate) (mapcar #'cdr
(stable-sort (mapcar (lambda (x) (cons (funcall costly-function x) x))
list) predicate :key #'car)))
(require :sb-posix)(schwartzian-transform (directory "/etc/*") (lambda (x) (sb-posix:stat-mtime (sb-posix:stat x))) #'<=)
http://codereview.stackexchange.com/a/138436/13050
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform December 16, 1994
#!/usr/bin/perlrequire 5; # new features, new bugs!print
map { $_->[0] }sort { $a->[1] cmp $b->[1] }map { [$_, /(\S+)$/] }<>;
Randal Schwartz in comp.unix.shells
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform Unfamiliar
ComplexUndocumentedHard to learn
Too cleverNew
Different
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform OMFG
AwesomeNew featuresLists of listsPower tools
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
Not documented
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
Easy to learn
Power tools
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform FMTEYEWTK
I'm not ragging on Randal, merely teasing a bit. He's just trying to be clever, and that's what he does. I'm just submitting a sample chapter for his perusal for inclusion the mythical Alpaca Book :-)
Tom Christiansen
Far More Than Everything You've Ever Wanted to Know About Sorting, http://www.perl.com/doc/FMTEYEWTK/sort.html
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform August 30, 1995
Or for possibly more efficiency, ensure that the calls only happen once per record, rather than approximately NlogN times, with the Schwartztransformation:-)
@keys = map { $_->[0] }sort { $a->[1] <=> $b->[1] or $a cmp $b }map { [ $_, datexform($foo{$_}) ] } keys %foo;
Bennett Todd in comp.lang.perl.misc
https://groups.google.com/forum/?hl=en#!topic/comp.lang.perl.misc/fLo0RNV8oW8
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform January 1996
http://www.stonehenge.com/merlyn/UnixReview/col06.html
Randal explains map-sort-map in Unix ReviewI'm going to talk about some sorts of sorts, and hopefully you'll sort everything out by the time you're finished reading. (And no, despite the similarity to my name, I will not talk about ``random sorts''.)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform April 1996
Tom labels a benchmark "Schwartzian XFrom" in comp.lang.perl.misc for “Read directory in timestamp order?”
https://groups.google.com/d/msg/comp.lang.perl.misc/pw-Hl4byLnc/yzejRnku3RoJ
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform July 1996
https://groups.google.com/d/msg/comp.lang.perl.misc/6NEeX4XJx54/nmpMmReMIbcJ
Colin Howarth in comp.lang.perl.misc
"Schwartzian transform of %$self ... help?"
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform October 1996
Tom posts a draft of perllol with "Schwartzian Transform"
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform December 1996
https://groups.google.com/d/msg/comp.lang.perl.misc/fPx42DB2jd8/cC_6osV70mMJ
Tom in comp.lang.perl.misc
I'm still pissed at Randal for having posted it, especially the way he did.
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
I hereby propose that the aforementioned Lispism, yclept “Schwartzian Transform", be recast in a less Teutonic albeit darker light; to wit, "Black Transform", as this spelling more accurately connotes its sinister subtleties. :-)
Tom later in the same thread
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform December 1996
I wonder if this chunk of code will haunt us forever.
Eric Arnold in comp.lang.perl.misc
https://groups.google.com/d/msg/comp.lang.perl.misc/fPx42DB2jd8/CTRmyWyJW6MJ
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform 1999
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform Orcish Manuever
@sorted = sort {( $times{$a} ||= -M $a ) <=>( $times{$b} ||= -M $b )
} @old_array;
Perl 4 compatible version
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform 2000
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform Python 2.4, 3
sorted = sorted(string_list, key=…)
string_list.sort(key=lambda …)
map(lambda x: x[1], sorted( map(lambda x: (f(x), x), old_list)))
new_list = zip(* sorted( zip(map(f, old_list), old_list)))[1]
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform Python 2
tmp2 = [ (int(s[10:15]), s) for s in L ] tmp2.sort()Isorted = [ x[1] for x in tmp2 ]
sorted([5, 2, 4, 1, 3], cmp=…)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform Ruby
[1,1.1,1.2,10].sort_by {|n| n.to_s}
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
•Innsbruck - CC BY 2.0 by Reisender1701 (Flickr) https://goo.gl/PuILnA
•Randal Schwartz - CC BY-SA 3.0 by Chris Marquardt https://commons.wikimedia.org/wiki/File:Randal_Schwartz_headshot_by_Chris_Marquardt.png
•Tom Christiansen - CC BY-SA 3.0 by Tim Bray https://en.wikipedia.org/wiki/File:Tom_Christiansen_in_2008.jpg
•Richard Stallman - CC BY-SA 3.0 by Thesupermat https://commons.wikimedia.org/wiki/File:Richard_Stallman_-_Fête_de_l%27Humanité_2014_-_010.jpg