Appendix D. List of Scala tips in this book
This book is not intended to teach you Scala, but rather provides Scala tips along the way to help you along, under the assumptions that Scala may not be your first and most familiar language and that you may not have seen all the requisite Scala tricks before. For books on learning Scala, see appendix C.
Below is a list of the Scala tips sprinkled throughout the book:
- Underscores mean different things in different places... 27
- The object keyword ... 65
- The apply() method ... 65
- Type inference of return values ... 68
- Type parameter for generics cannot be inferred ... 70
- The Option[] class ... 72
- Multiple imports on same line... 76
- Backticks to escape reserved words... 78
- Pasting blocks of code into the REPL... 79
- Multiple parameter lists ... 87
- Named parameters ... 88
- Optional parentheses on function invocation... 98
- Regex and “raw” strings ... 104
- For comprehensions... 106
- List operator +: for appending ... 114
- The type keyword ... 116
- ClassTag... 119
- Multiple return values 131
- Dot product idiom using zip(), map(), and reduce()... 132
- HashMap initialization using -> ... 161
- Formatted output using "${myVar}"... 172