Skip to content

Commit

Permalink
Merge pull request #24 from andreas-roehler/master
Browse files Browse the repository at this point in the history
#23, Exercise 2.1.7.1 honour comment, pattern-match on tuple
  • Loading branch information
winitzki authored Nov 30, 2023
2 parents 6b7c487 + f80d6eb commit 0d9070c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*~
*RCS*
*.class
*.log

Expand Down
4 changes: 2 additions & 2 deletions chapter02/worksheets/solution2.1.7.1_AR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Exercise 2.1.7.1
*/

val a = (0 to 9).flatMap(x => (0 to 9).map { y => (x, y) } )
val b = a.map{ case x => x._1 + 4 * x._2 }
val c = a.map{ case x => x._1 * x._2 }
val b = a.map{ case (x, y) => x + 4 * y }
val c = a.map{ case (x, y) => x * y }
val d = b.zip(c)
val result = d.filter { case (x, y) => x > y }

Expand Down

0 comments on commit 0d9070c

Please sign in to comment.