Re: Schwartzian Transform
Adam Turoff <[EMAIL PROTECTED]> writes: > We're all for making easy things easy, but the complexities of > "map {} sort {} map {} @list" has always been befuddling to newbies, > especially when reading the code left-to-right. I've always thought that the purpose of the Schwartzian transform was to separate newbies from Real Programmers. :-) -- Johan
Re: Schwartzian Transform
Uri Guttman wrote: > records can be strings, or any perl [LH]o[LH]. y/L/A/; > for a schwartz (drop the 'ian') or GR transform. Why? So it conforms with the "Guttman-Rosler" naming standard? -- John Porter
Re: Schwartzian Transform
On Wed, Mar 21, 2001 at 10:24:05AM -0500, John Porter wrote: > Uri Guttman wrote: > > records can be strings, or any perl [LH]o[LH]. > > y/L/A/; > > > > for a schwartz (drop the 'ian') or GR transform. > > Why? So it conforms with the "Guttman-Rosler" naming standard? Which *I* would call "Macdonald transform" anyway :-) (John Macdonald suggested the trick to me at least a year before the GR paper, and it's there in the Sorting chapter, though it is not called by any special name...) > -- > John Porter -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Schwartzian Transform
Jarkko Hietaniemi wrote: > (John Macdonald suggested the trick to me at least a year before > the GR paper, and it's there in the Sorting chapter, though it is > not called by any special name...) Very interesting indeed. No special name, huh? Maybe that's the way it ought to be. -- John Porter Useless use of time in void context.
Re: Schwartzian Transform
> "John" == John Porter <[EMAIL PROTECTED]> writes: John> No special name, huh? Maybe that's the way it ought to be. That's the way I feel occasionally about the Schwartzian Transform, actually. Having to explain that it was named *for* me but not *by* me (in fact, actually to spite me, if I recall). Although it is fun when we get to the "Schwartizian Transform Illustrated" page in my slideset... I get to say "don't wait for the swimsuit issue... it's not a very pretty sight". -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Schwartzian Transform
> "JH" == Jarkko Hietaniemi <[EMAIL PROTECTED]> writes: JH> On Wed, Mar 21, 2001 at 10:24:05AM -0500, John Porter wrote: >> Uri Guttman wrote: >> > records can be strings, or any perl [LH]o[LH]. >> >> y/L/A/; >> >> >> > for a schwartz (drop the 'ian') or GR transform. >> >> Why? So it conforms with the "Guttman-Rosler" naming standard? JH> Which *I* would call "Macdonald transform" anyway :-) JH> (John Macdonald suggested the trick to me at least a year before JH> the GR paper, and it's there in the Sorting chapter, though it is JH> not called by any special name...) well, the basic technique is much older than that. i believe it was first used in the 60's on mainframes. remember, sorting massive numbers of records was a large task in those days. ever heard of tape sorts and other strange algorithms. larry rosler and i never claimed to have invented this. we just codified it clearly and covered as many angles of it in the perl domain that we could find. larry in fact worked on finding ways to GRT sort on all common field types including signed and unsigned integers, floats (IEEE format only) and variable length strings. as for giving it a name, others were asking what to call it and this was the consensus name that came up. we didn't push for it. BTW no one responded to my suggestion for Sort::Records to be in the core (core library rather than perl core) on perl6. nor did anyone jump up and say they wanted to help work on it. uri -- Uri Guttman - [EMAIL PROTECTED] -- http://www.sysarch.com SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting The Perl Books Page --- http://www.sysarch.com/cgi-bin/perl_books The Best Search Engine on the Net -- http://www.northernlight.com
Re: Schwartzian Transform
> "JP" == John Porter <[EMAIL PROTECTED]> writes: JP> Uri Guttman wrote: >> records can be strings, or any perl [LH]o[LH]. JP> y/L/A/; tell that to perllol :) >> for a schwartz (drop the 'ian') or GR transform. JP> Why? So it conforms with the "Guttman-Rosler" naming standard? that has been discussed elsewhere. the 'ian' suffix is overkill. think about all the classic mathematical transforms and they don't append 'ian' to the person's name. fourier, laplace, etc. maybe schwartzian sounds better but it is odd (and probably grammatically wrong) to add 'ian' to his name for this use. but i doubt it will be dropped as it is reached a critical mass of acceptance. uri -- Uri Guttman - [EMAIL PROTECTED] -- http://www.sysarch.com SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting The Perl Books Page --- http://www.sysarch.com/cgi-bin/perl_books The Best Search Engine on the Net -- http://www.northernlight.com
Re: Schwartzian Transform
Uri Guttman wrote: > JP> y/L/A/; > > tell that to perllol :) I do, through clenched teeth, every time I see it. "Perl: Laughing Out Loud" :-) > the 'ian' suffix is overkill. think > about all the classic mathematical transforms and they don't append > 'ian' to the person's name. fourier, laplace, etc. I find tons of counter-examples. Lorentzian. Newtonian. Langrangian. Smithsonian. Brownian. Wronskian. Boolean. Gaussian. Keplerian. Orwellian. Hegelian. Russellian. Gregorian. Dickensian. Cartesian. Bayesian. Edwardian. Lucasian. Pavlovian. Euclidean. Laplacian. Darwinian. Hamiltonian. Jeffersonian. etc. I don't think adding "-ian" to a name to make it an adjective is particularly bizarre. It also doesn't seem to violate any rules of grammer that I know of. And there's nothing special about a transform, that different rules would apply to it anyway. > maybe schwartzian sounds better Indeed; afaict, how a proper noun is converted into an adjective seems to depend *entirely* on how it sounds. There's no reason it couldn't be "Hawkingian radiation" except that absolutely no one would say that! -- John Porter Useless use of time in void context.
Re: Schwartzian Transform
On Wed, 21 Mar 2001 15:40:20 -0500, John Porter wrote: >Uri Guttman wrote: >> JP> y/L/A/; >> >> tell that to perllol :) > >I do, through clenched teeth, every time I see it. IMHO, it is: HoA HoH LoA LoH -- Bart.
Re: Schwartzian Transform
Bart Lateur wrote: > IMHO, it is: HoA, HoH, LoA, LoH But that's only two levels, when the number of levels can really be unbounded. Only the *top* level can be a list, rather than an array. Since any two levels can have a relationship ...->[0]->[0]->... ...->[0]->{X}->... ...->{X}->[0]->... ...->{X}->{X}->... that calls for AoA, AoH, HoA, HoH. -- John Porter Useless use of time in void context.
Re: Schwartzian Transform
> Loooking over dev.perl.org/rfc, only two RFCs mention sorting: > RFC 124: Sort order for any hash > RFC 304: sort algorithm to be selectable at compile time > > and none mentioning the Schwartz. :-) > > This message is not an RFC, nor is it an intent to add a feature > to Perl or specify a syntax for that feature[*]. I just posted it to > get the idea into the archives as a (possibly) useful way to improve Perl. Well, why the disclaimer? If it is a 'useful way to improve Perl', then it *is* an intent to add a feature. And in a looser sense of the word, it is a Request For Comments. You are asking for comments on a whether or not a given feature would be good to have natively in perl, right? And I've seen too many 'good ideas' get lost in the noise by just stating them as emails, so I wouldn't trust archiving via email list. So, I'll ask it again - why are RFCs so horrid? And why the artificial deadline for them? Ed
Re: Schwartzian Transform
Hey, I just have a couple of ideas that may either make me look like a fool or provoke some discussion: Personally, I have never used the Schwartzian Transform (but I have heard, looked at it), so I may not be fully knowledgeable of its usefulness. However, do the advantages of including it outweigh the disadvantages? I have read all of the messages on this topic to this point and I haven't seen much discussion from this aspect, but a lot on what the function would be named, etc. The argument for including this was that many newbies may not be able to understand it very well. But, do you need to understand the intricacies if you can just cut and paste and just change a few variables? Couldn't it be included as a module and be implemented basically the same way? Over my long experience with perl (not even one year :-) ), I have heard a lot about it being slow. Wouldn't adding functions like this just make it needlessly slower? Please correct me if I am wrong. I am just trying to begin some discussion from this point of view. -- Zenon "zdog" Zabinski
Re: Schwartzian Transform
John Porter declared: Adam Turoff wrote: > This message is not an RFC, nor is it an intent to add a feature to Perl or specify a syntax for that feature[*]. Yay. > We're all for making easy things easy, but the complexities of > "map {} sort {} map {} @list" has always been befuddling to newbies, especially when reading the code left-to-right. So you think @s = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [ $_, /num:(\d+)/ ] } @t; would be more clearly written as @s = schwartzian( { second_map => sub { $_->[0] }, the_sort=> sub { $a->[1] <=> $b->[1] }, first_map => sub { [ $_, /num:(\d+)/ ] }, }, @t ); --- How about this? @array=tsort { /num:(\d+)/ } numerically #optional @array; is handled by something like tsort(&;&@) { my $t=shift; my $s=shift || sub { $a cmp $b }; my @a=@_ || (something); return map { $_->[0] } sort { $a=$a->[1]; $b=$b->[1]; &$s; } map { [ $_ , $t ] } @a; } It's totally untested, but you get the idea... Or, a slightly different syntax from yours: schwartzian { first {...} sort {...} last {...} } @ary; --Brent Dax Excuse typos, it's hahd to write on a Palm...