Skip to content

Commit

Permalink
Exercise 5.2: Use underscore placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
astorije committed Jan 4, 2015
1 parent 4e57243 commit 17de80c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion answerkey/laziness/02.answer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ answer lazily. It must traverse the first `n` elements of the stream eagerly.
*/
@annotation.tailrec
final def drop(n: Int): Stream[A] = this match {
case Cons(h, t) if n > 0 => t().drop(n - 1)
case Cons(_, t) if n > 0 => t().drop(n - 1)
case _ => this
}

2 changes: 1 addition & 1 deletion answers/src/main/scala/fpinscala/laziness/Stream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ trait Stream[+A] {
*/
@annotation.tailrec
final def drop(n: Int): Stream[A] = this match {
case Cons(h, t) if n > 0 => t().drop(n - 1)
case Cons(_, t) if n > 0 => t().drop(n - 1)
case _ => this
}

Expand Down

0 comments on commit 17de80c

Please sign in to comment.