Skip to content

Instantly share code, notes, and snippets.

@ygpark2
Created July 22, 2014 05:30
Show Gist options
  • Save ygpark2/da3df612d7349debb5ee to your computer and use it in GitHub Desktop.
Save ygpark2/da3df612d7349debb5ee to your computer and use it in GitHub Desktop.
multiplication table
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