the surprisingly tense history of the schwartzian transform
TRANSCRIPT
![Page 1: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/1.jpg)
Alpine Perl Workshop 2016 • brian d foy
The Surprisingly Tense History of the
Schwartzian Transform
![Page 2: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/2.jpg)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
http://bit.ly/2bHNNx4
![Page 3: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/3.jpg)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
Randal Schwartz
Just another
hacker.
• troff• emacs•Lisp•Perl•Smalltalk•…
![Page 4: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/4.jpg)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
Tom Christiansen
• Languages geek • Csh god• Perl evangelist
![Page 5: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/5.jpg)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform The Technique
Its ExpressionThe Arguments
Its NameThe Reckoning
![Page 6: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/6.jpg)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
decoratesort
undecorate
![Page 7: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/7.jpg)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
computeassociate
sortmap
![Page 8: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/8.jpg)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
Richard Stallman
• Editor editor• GNU• Free Software
![Page 9: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/9.jpg)
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
![Page 10: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/10.jpg)
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
![Page 11: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/11.jpg)
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
![Page 12: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/12.jpg)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform Unfamiliar
ComplexUndocumentedHard to learn
Too cleverNew
Different
![Page 13: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/13.jpg)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform OMFG
AwesomeNew featuresLists of listsPower tools
![Page 14: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/14.jpg)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
Not documented
![Page 15: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/15.jpg)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform
Easy to learn
Power tools
![Page 16: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/16.jpg)
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
![Page 17: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/17.jpg)
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
![Page 18: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/18.jpg)
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''.)
![Page 19: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/19.jpg)
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
![Page 20: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/20.jpg)
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?"
![Page 21: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/21.jpg)
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"
![Page 22: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/22.jpg)
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.
![Page 23: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/23.jpg)
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
![Page 24: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/24.jpg)
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
![Page 25: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/25.jpg)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform 1999
![Page 26: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/26.jpg)
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
![Page 27: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/27.jpg)
The Perl Review • www.theperlreview.com
The Surprisingly Tense History of the Schwartzian Transform 2000
![Page 28: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/28.jpg)
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]
![Page 29: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/29.jpg)
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=…)
![Page 30: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/30.jpg)
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}
![Page 31: The Surprisingly Tense History of the Schwartzian Transform](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f745f1a28ab10258b5b6b/html5/thumbnails/31.jpg)
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