Skip to content

Instantly share code, notes, and snippets.

@Exey
Last active March 3, 2021 22:06
Show Gist options
  • Save Exey/9c25e3780c34ed7b5e07e70ceab1062e to your computer and use it in GitHub Desktop.
Save Exey/9c25e3780c34ed7b5e07e70ceab1062e to your computer and use it in GitHub Desktop.
not compilable
let array = [Int]()
let dic = [Int : Double]()
let tuple = array
.map { c -> (a: Int, b: Double) in return (a: c, b: dic[c]!) }
.sorted(by: { (x, y) -> Bool in return x.b == y.b ? x.a < y.a : x.b > y.b }).first!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment