Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Advanced Sorting - GRT - Guttman Rosler Transform

by I0 (Priest)
on Aug 18, 2009 at 09:45 UTC ( #789405=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Advanced Sorting - GRT - Guttman Rosler Transform
in thread Advanced Sorting - GRT - Guttman Rosler Transform

I don't believe that the GRT can be sufficiently generalized in any practical sense to cover all problems
Given a function to convert floats to lexicographically ordered strings, you should be able do a GRT on any series of || linked cmp and <=> operator operators. Are there any antisymmetric, transitive, total relations that can't be written as a series of || linked cmp and <=> operators?


Comment on Re^3: Advanced Sorting - GRT - Guttman Rosler Transform
Select or Download Code
Re^4: Advanced Sorting - GRT - Guttman Rosler Transform
by JavaFan (Canon) on Aug 18, 2009 at 10:15 UTC
    Easy. Imagine you have to sort objects. Objects written by someone who understands encapsulation (hence, unlikely to be a native Perl programmer). So, there's no way to compare two objects using an operator - you've got to call a method in one of the objects, passing the other as argument, for instance:
    @sorted = sort {$a->cmp($b)} @unsorted;
    I doubt you can either use a ST or a GRT (I am one of the people who don't think GRT is a special case of ST) to sort this.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://789405]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2015-07-06 08:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls