Created
March 21, 2013 08:53
-
-
Save ryoppy/5211636 to your computer and use it in GitHub Desktop.
Zipが便利すぎたのでメモ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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