Due Date
Description
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.
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 MyList.scala
.
More complete directions are contained in the aforementioned files.
Grading
A breakdown of the grade follows:
- Completing the missing pieces of the tutorial: 10%
- Problem 1 of
SmallerProblems.scala
: 5% - Problem 2 of
SmallerProblems.scala
: 15% - Problem 3 of
SmallerProblems.scala
: 10% (majority on run-length encoding) foldLeft
andfoldRight
inMyList.scala
: 20%filter
andmap
inMyList.scala
: 10%flatMap
inMyList.scala
: 10%- All other missing pieces of
MyList.scala
: 20%
One other important note with grading: with the exception of var
s we have introduced, you may not use any mutable state.
That is, you cannot introduce new var
s or any mutable data structures, only modify the few existing var
s 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.
Deliverables
You must turnin
all files with the .scala
extension.
The command below should be sufficient:
turnin assign1@cs162 MyList.scala SmallerProblems.scala tutorial/*.scala