Conventions
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We can include other contexts through the use of the include
directive."
A block of code is set as follows:
import scala.util.hashing.MurmurHash3._ val markLow = 0 val markHigh = 4096 val seed = 12345 def consistentFilter(s: String): Boolean = { val hash = stringHash(s.split(" ")(0), seed) >>> 16 hash >= markLow && hash < markHigh } val w = new java.io.FileWriter(new java.io.File("out.txt")) val lines = io.Source.fromFile("chapter01/data/iris/in.txt").getLines lines.filter(consistentFilter).foreach { s => w.write(s + Properties.lineSeparator) }
Any command-line input or output is written as follows:
akozlov@Alexanders-MacBook-Pro]$ scala Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40). Type in expressions to have them evaluated. Type :help for more information. scala> import scala.util.Random import scala.util.Random
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Run all cells at once by navigating to Cell | Run All."
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.