Skip to content

Instantly share code, notes, and snippets.

@ryoppy
Created March 21, 2013 08:53
Show Gist options
  • Save ryoppy/5211636 to your computer and use it in GitHub Desktop.
Save ryoppy/5211636 to your computer and use it in GitHub Desktop.
Zipが便利すぎたのでメモ
val pp1 = Seq(1, 2) zip Seq(3, 4)
println(pp1)
// List((1,3), (2,4))
case class Image(width: Seq[Int], height: Seq[Int])
val images = Seq(Image(Seq(200, 300), Seq(210, 310)), Image(Seq(400, 500), Seq(510, 610)))
val pp2 = images.flatMap { b =>
b.width zip b.height
}
println(pp2)
//List((200,210), (300,310), (400,510), (500,610))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment