Created
July 22, 2014 05:30
-
-
Save ygpark2/da3df612d7349debb5ee to your computer and use it in GitHub Desktop.
multiplication table
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
List.fill(9)(1 to 9).zipWithIndex.map{ case(v, i) => v.map(a => f"$a%02d * ${i+1}%02d = ${a*(i+1)}%02d") }.flatten.map(println) | |
(1 to 9).flatMap( x => (1 to 9).map( (x, _) )).map(x => f"${x._1}%02d * ${x._2}%02d = ${x._1 * x._2}%02d").foreach(println) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment