DanielaSfregola / get-programming-with-scala

Code for the book "Get Programming with Scala" (Manning)
https://www.manning.com/books/get-programming-with-scala?a_aid=daniela&a_bid=7cd2421c
MIT License
79 stars 32 forks source link

Get Programming with Scala

Code, exercises, and answers for the book Get Programming with Scala.

Lessons are grouped per unit. Each lesson is a standalone sbt project and it has the following three packages: listings, quickchecks, trythis.

Have a look at the Table of Contents for links to all the book lessons.

Installation Requirements

Make sure the following tools are installed:

Running the Code

Code Snippets (Scala Worksheets)

Some lessons are simple snippets (files with extension *.sc) also called Scala Worksheets. They can be interpreted interactively from the REPL by IDEs with dedicated Scala support, such as IntelliJ IDEA and ScalaIDE.

If you a using a text editor or your IDE doesn't support Scala Worksheets, start the REPL from sbt:

sbt console

and evaluate the file as follows:

> :load /path/to/file.sc

Executable sbt Programs

Some lessons are fully fleshed-out programs (files with extension *.scala): in order to run them, they need to be compiled. First, navigate to the folder of the lesson you are interested in.

Suppose you want to review the code for lesson 8:

cd unit1/lesson8

Start sbt:

sbt

Compile and run the code:

> run

If a lecture isn't an executable program, please see section on running Scala Worksheets.

Table of Contents