Skip to content

Commit

Permalink
assert added
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Roehler <andreas.roehler@online.de>
  • Loading branch information
andreas-roehler committed Jan 7, 2024
1 parent 3949f62 commit 6c37500
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions chapter01/worksheets/solution1.6.2.2.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ val r = p.map(x => q.filter(y => (x != y) && (x % y == 0)) )
val s = p zip r
val t = s.map{ case (x, y) => (x, y.length) }
val result = t.filter{ case (x, y) => 3 == y }.map{ case (x, y) => x }
val expected = Vector(16, 81, 625)
assert(result == expected)

print("3-factor result among n ∈ [1, ..., 1000]: %s\n".format(result))

Expand Down

0 comments on commit 6c37500

Please sign in to comment.