# HG changeset patch # User Christian Urban # Date 1572359691 0 # Node ID 2d290b79fc732f33aadfc3f7b2af765dc7df7089 # Parent 32dfd2ca577bd7cfb45910f2b97dc3fb3af81564 updated diff -r 32dfd2ca577b -r 2d290b79fc73 cws/cw01.pdf Binary file cws/cw01.pdf has changed diff -r 32dfd2ca577b -r 2d290b79fc73 cws/cw01.tex --- a/cws/cw01.tex Tue Oct 29 14:12:24 2019 +0000 +++ b/cws/cw01.tex Tue Oct 29 14:34:51 2019 +0000 @@ -15,8 +15,8 @@ \noindent This assignment is about Scala and worth 10\%. The preliminary -part is due on \cwSIX{} at 16pm, and the core part on \cwSIXa{} -at 16pm. You are asked to implement two programs about list +part is due on \cwSIX{} at 4pm, and the core part on \cwSIXa{} +at 4pm. You are asked to implement two programs about list processing and recursion. The core part is more advanced and might include material you have not yet seen in the first lecture. \bigskip @@ -143,7 +143,7 @@ $1$ Million. \hfill[2 Marks] \item[(2)] Write a second function that takes an upper bound as - argument and calculates the steps for all numbers in the range from + an argument and calculates the steps for all numbers in the range from 1 up to this bound (the bound including). It returns the maximum number of steps and the corresponding number that needs that many steps. More precisely it returns a pair where the first component is the number @@ -246,9 +246,9 @@ (first line), 2011 (second line) and 2012 (third line) you obtain: \begin{verbatim} - List(List(Some(312.204773), Some(26.782711)), - List(Some(301.0466), Some(41.244694)), - List(Some(331.462585), Some(51.464207))) + List(List(Some(311.349976), Some(20.544939)), + List(Some(300.222351), Some(31.638695)), + List(Some(330.555054), Some(39.478039)))) \end{verbatim}\hfill[1 Mark] diff -r 32dfd2ca577b -r 2d290b79fc73 solutions1/collatz.scala --- a/solutions1/collatz.scala Tue Oct 29 14:12:24 2019 +0000 +++ b/solutions1/collatz.scala Tue Oct 29 14:34:51 2019 +0000 @@ -1,4 +1,4 @@ -// Part 1 about the 3n+1 conjecture +// Basic Part about the 3n+1 conjecture //================================== // generate jar with diff -r 32dfd2ca577b -r 2d290b79fc73 solutions1/drumb.scala --- a/solutions1/drumb.scala Tue Oct 29 14:12:24 2019 +0000 +++ b/solutions1/drumb.scala Tue Oct 29 14:34:51 2019 +0000 @@ -1,7 +1,12 @@ -// Part 2 and 3 about a really dumb investment strategy -//====================================================== +// Core Part 6 about a really dumb investment strategy +//===================================================== + -object CW6b { // for purposes of generating a jar +// generate jar with +// > scala -d drumb.jar drumb.scala + + +object CW6b { //two test portfolios