The Artima Developer Community


Errata for Programming in Scala, 4th Edition
Chapter 16: Case Classes and Pattern Matching
Return to errata index.

Page 305 (PDF page 343):
Listing 15.22 says

def show(e: Expr) = s"${println(f.format(e))}\n\n"

But since "\n\n" is not part of the String passed to function println, it
won't produce the line-spacing between expressions shown on page 306.

The code below seems more accurate:

def show(e: Expr) = println(s"${f.format(e)}\n\n")

----
Fixed in 5ed. Tnx.

Page number: Book type: Paperback book PDF eBook
Book version: (Or build date. Found on back of title page.)
Your feedback:
Your name: (optional)
Your email address: (optional) (will not be published)

Copyright © 2021 Artima, Inc. All rights reserved.