Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^3: reverse sort arrays in subroutines

by choroba (Chancellor)
on May 21, 2013 at 22:05 UTC ( #1034620=note: print w/replies, xml ) Need Help??

in reply to Re^2: reverse sort arrays in subroutines
in thread reverse sort arrays in subroutines

I was probably not explicit enough. Let's take an example:
1 3 2
If we first reverse it, we get
2 3 1
and then we sort it to get
1 2 3

On the other hand, if we sort it first, we get

1 2 3
and we can then reverse it to
3 2 1

Functions are not called left to right, but from the innermost to the outermost, i.e. rather right to left.

لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1034620]
[Eily]: marto I clearly don't have the thread knowledge to understand the importance of that example
[choroba]: the related discussion on Hacker news is interesting
[choroba]: not so many Perl haters so far

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2017-07-26 14:12 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (396 votes). Check out past polls.