Skip to content

Commit

Permalink
Merge pull request #12 from andreas-roehler/master
Browse files Browse the repository at this point in the history
#11, solution2.1.7.5.scala
  • Loading branch information
winitzki authored Nov 25, 2023
2 parents f19fda6 + d775aae commit e2fdc6e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions chapter02/worksheets/solution2.1.7.5.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
val p = Seq("a", "b", "c")
val q = Seq(10, -1, 5)

p.zip(q).sortBy(_._2).map{case (x, y) => x}

// scala> :load solution2.1.7.5.scala
// Loading solution2.1.7.5.scala...
// p: Seq[String] = List(a, b, c)
// q: Seq[Int] = List(10, -1, 5)
// res0: Seq[String] = List(b, c, a)

0 comments on commit e2fdc6e

Please sign in to comment.