Talk:Schwartzian transform

message: Per comments below, I am going to rewrite this article so that it features a simple example of the idiom in Perl, a pseudocode implementation, concise history, and context in other programming languages. The wikibook algorithm page is messed up and also needs to be rewritten. I don't know anything about Python - however, I think what's notable about "Schwartzian Transformation" and Python is not the illustration of a Python implementation, but the fact that the Python community adopted the Perl term to describe an idiom that looks and behaves different in Python.
The Schwartzian Transform in Perl is a fairly difficult construct to understand, and I don't have any problem with presenting an explanation that, while accurate, requires some study to comprehend.
Finally, while I understand the desire to move material that should better be in a programming book into the algorithm wikibook, this is an article about a programming idiom, and there is no need to ask a reader to go seek essential information elsewhere. Joseph N Hall 23:38, 30 August 2006 (UTC)
replies: text: I cleaned up the page, clarifying the difference between the "Schwartzian transform" idiom and other versions of the underlying algorithm, displaying the actual idiom more prominently and explaining it, while also keeping a procedural example of a similar algorithm. This also addresses some contradictions present in the previous version (stemming from the confusion between the idiom and the algorithm). 87.17.241.194 19:17, 20 September 2006 (UTC)
thread_title: Rewrite

message: For reference, the earliest appearance of the transform in Perl in print (USENET, that is) is apparently this thread in comp.unix.shell. Randal was a LISP programmer and expressed this functional programming construct in Perl 5. The popularization of the term "Schwartzian Transform" (and perhaps the coinage itself) is probably due to Tom Christiansen, although various combinations of "Schwartz" and "transform" may have appeared before Christiansen gave the construct its enduring name. Bennett Todd referred to it as the "Schwartz transformation" in this article in August 1995. It is covered formally in both Christiansen's 1995-vintage perllol man page ("lists of lists") and Randal's January 1996 UnixReview column. Joseph N Hall 10:22, 26 August 2006 (UTC)
replies: text: I know little about Python, but apparently the term "Schwartzian Transform" had made its way into the Python community as early as 2001, if the date on this posting is accurate. Joseph N Hall 00:04, 29 August 2006 (UTC)

text: (The current version of the Perl Timeline is incorrect and refers to a later date in 1995.)
I believe this is based on Randal's own recollection over at . According to Randal, it was in that April thread that Tom Christiansen stepped in with the naming bit, which is likely why the Dec 1994 thread didn't make it into the Perl Timeline. So, I guess the is incorrect verbiage is a bit blunt here.
BACbKA (talk) 05:23, 24 May 2013 (UTC)
thread_title: History Lesson

message: The access to index 0 is often more quick than to other indexes but never slower. sort has more index accesses than the first written map.
 @new = map  { $_->[1] }
        sort { $a->[0] <=> $b->[0] }
        map  { [foo($_), $_] }
        @old;
Steffen Winkler, http:://erlangen.pm.org/
88.65.95.170 (talk) 05:43, 31 May 2008 (UTC)
replies: text: Curious.  Where do you get the idea that accessing index 0 is faster than index 1? --Randal L. Schwartz (talk) 07:56, 31 May 2008 (UTC)
replies: text: It's a tiny bit faster, because you don't have to do the multiplication by element size and the addition to the array origin to get the address of the element, but this is a lot of work for a compiler to do for such a small gain, at least it seems to be. I don't know if anyone has instrumented it, or if the Perl compiler already does this optimization. If not, maybe we need a special Schwartzian transform operation in an optimized module written directly in C that would take advantage of this.Bostoner (talk) 21:24, 17 November 2009 (UTC)

text: BTW, I don't know if there is a name for this, but if the operation is reversible, depending on how expensive it is, it might in some cases be faster to transform each element and then transform them back. I do this to sort pathnames by directory (so all of the files in the same directory are next to each other then in alphabetical order). I replace each path separator with a null character, sort, and replace the nulls with the separator again.Bostoner (talk) 21:24, 17 November 2009 (UTC)
replies: text:  I originally wrote the ST a lot like this, but then I switched to always having the 0 element be the original value, for consistency.  Some uses of the ST involve multiple keys, for example, so they'd end up as elements 1, 2, 3, etc. --Randal L. Schwartz (talk) 01:31, 18 November 2009 (UTC)
thread_title: modify the Schwartz idea for more speed

message: I have removed the Perl 6 example, as it did not do the same thing at all, rather performed a case-insensitive sort:
 Later, Perl 6 has improved on the code length considerably:Blog entry by Moritz Lenz
 
 
 # (Perl 6)
 
 @a = @a.sort: { .uc };
 
TimR (talk) 14:36, 13 May 2009 (UTC)
thread_title:  Perl 6 example