The goal of this assignment is to familiarize yourself with Scala. We have provided a basic tutorial on Scala to help this process along, which focuses specifically on points which are directly relevant to CS162. This tutorial is supplemented by the book "Programming Scala" by Dean Wampler, specifically chapters 1, 2, 3, 5, 6, and 8; this book is available online in the class website's page on Scala resources. It is recommended that you read these chapters along with doing the tutorial.
Download the template code and tutorial here.
As a first step, you should go through this tutorial and fill in missing portions as needed to get code to run correctly.
With the tutorial, you should start with
introduction.html, then proceed through the scala files in order (starting with 0, then 1, etc.).
Once you've completed the tutorial, there are three problems in
SmallerProblems.scala which you must solve.
Finally, you need to fill in the missing implementations in
More complete directions are contained in the aforementioned files.
A breakdown of the grade follows:
- Completing the missing pieces of the tutorial: 10%
- Problem 1 of
- Problem 2 of
- Problem 3 of
SmallerProblems.scala: 10% (majority on run-length encoding)
- All other missing pieces of
One other important note with grading: with the exception of
vars we have introduced, you may not use any mutable state.
That is, you cannot introduce new
vars or any mutable data structures, only modify the few existing
vars we have provided.
This is to encourage you to think in a functional way, rather than to write Java/Python with a new syntax.
This is expected to be difficult - you are learning to think in a way that you have probably never had to before, so it is somewhat like learning programming all over again.
turnin all files with the
The command below should be sufficient:
turnin assign1@cs162 MyList.scala SmallerProblems.scala tutorial/*.scala