fork download
  1. sorti = ->a {a.map.with_index.sort.map(&:last)}
  2. f = ->a {sorti.call sorti.call a}
  3. g = ->a {p f.(a)}
  4. g.([1,100,10,10000,1000])
  5. g.([3,1,4,1,5,9,2])
  6. g.([0,1,0,1,0,1,0,1])
Success #stdin #stdout 0.01s 8088KB
stdin
Standard input is empty
stdout
[0, 2, 1, 4, 3]
[3, 0, 4, 1, 5, 6, 2]
[0, 4, 1, 5, 2, 6, 3, 7]