# HG changeset patch # User Christian Urban # Date 1485307504 0 # Node ID 350d4364f6f93b8457e2c5b47525ff927a9f0d59 # Parent 085bf16963c6699050603320c3a2a869611691f6# Parent 93260be6770f579aa9fb437eff246e8354c2eea6 updated diff -r 085bf16963c6 -r 350d4364f6f9 README --- a/README Wed Jan 11 14:56:16 2017 +0000 +++ b/README Wed Jan 25 01:25:04 2017 +0000 @@ -32,4 +32,11 @@ LC_ALL=C sed -i.2 -- 's|println(matcher(EVIL,|//println(matcher(EVIL,|g' k*/re.scala.bak -LC_ALL=C sed -i.2 -- 's|for (i <- 1 to 5000001 by 500000)|for (i <- 1 to 11 by 10)|g' k*/re.scala.bak \ No newline at end of file +LC_ALL=C sed -i.2 -- 's|for (i <- 1 to 5000001 by 500000)|for (i <- 1 to 11 by 10)|g' k*/re.scala.bak + + + +ontime: +k1502660 +k1502705 +k1502679 \ No newline at end of file diff -r 085bf16963c6 -r 350d4364f6f9 cws/cw03.pdf Binary file cws/cw03.pdf has changed diff -r 085bf16963c6 -r 350d4364f6f9 cws/cw03.tex --- a/cws/cw03.tex Wed Jan 11 14:56:16 2017 +0000 +++ b/cws/cw03.tex Wed Jan 25 01:25:04 2017 +0000 @@ -4,7 +4,7 @@ \begin{document} -\section*{Coursework 8 (Scala, Regular Expressions} +\section*{Coursework 8 (Scala, Regular Expressions)} This coursework is worth 10\%. It is about regular expressions, pattern matching and polymorphism. The first part is due on 30 diff -r 085bf16963c6 -r 350d4364f6f9 cws/cw04.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cws/cw04.tex Wed Jan 25 01:25:04 2017 +0000 @@ -0,0 +1,45 @@ +\documentclass{article} +\usepackage{../style} +\usepackage{../langs} + +\begin{document} + +\section*{Replacement Coursework 1 (Roman Nmerals)} + +This coursework is worth 10\%. It is about translating roman numerals +into integers and also about validating roman numerals. The cursework +is due on 1 February at 5pm. Make sure the files you submit can +be processed by just calling \texttt{scala + <>}.\bigskip + +\noindent +\textbf{Important:} Do not use any mutable data structures in your +submission! They are not needed. This excludes the use of +\texttt{ListBuffer}s, for example. Do not use \texttt{return} in your +code! It has a different meaning in Scala, than in Java. Do not use +\texttt{var}! This declares a mutable variable. Make sure the +functions you submit are defined on the ``top-level'' of Scala, not +inside a class or object. Also note that the running time +will be restricted to a maximum of 360 seconds. + + +\subsection*{Disclaimer} + +It should be understood that the work you submit represents +your own effort! You have not copied from anyone else. An +exception is the Scala code I showed during the lectures or +uploaded to KEATS, which you can freely use.\bigskip + + +\subsection*{Part 1 (Translation)} + +\subsection*{Part 2 (Validation)} + + +\end{document} + + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: diff -r 085bf16963c6 -r 350d4364f6f9 marking/drumb_test2.scala --- a/marking/drumb_test2.scala Wed Jan 11 14:56:16 2017 +0000 +++ b/marking/drumb_test2.scala Wed Jan 25 01:25:04 2017 +0000 @@ -5,10 +5,21 @@ import ExecutionContext.Implicits.global import scala.language.postfixOps +val urban_prices = List(List(Some(71.539941), None), + List(Some(76.974614), None), + List(Some(65.226685), Some(6.35)), + List(Some(78.354649), Some(12.241)), + List(Some(85.517645), Some(38.188))) + +val urban_deltas = List(List(Some(0.07596697626574789), None), + List(Some(-0.152620823795232), None), + List(Some(0.20126676681483952), Some(0.9277165354330709)), + List(Some(0.09141762603007778), Some(2.119679764725104))) + + lazy val f = Future { - assert(get_prices(List("BIDU"), 2004 to 2008) == List(List(None), List(None), - List(Some(6.35)), List(Some(12.241)), - List(Some(38.188)))) + //assert(get_deltas(urban_prices) == urban_deltas) + assert (get_deltas(get_prices(List("IBM", "BIDU"), 2004 to 2008)) == urban_deltas) } diff -r 085bf16963c6 -r 350d4364f6f9 marking/mark01b --- a/marking/mark01b Wed Jan 11 14:56:16 2017 +0000 +++ b/marking/mark01b Wed Jan 25 01:25:04 2017 +0000 @@ -1,7 +1,7 @@ #!/bin/bash set -e -out=${1:-output} +out=${1:-output2} echo "" > $out @@ -55,7 +55,7 @@ echo " List(List(None), List(None), List(Some(6.35))," | tee -a $out echo " List(Some(12.241)), List(Some(38.188)))" | tee -a $out - if (scala_assert "drumb.scala" "../drumb_test1.scala") + if (scala_assert "drumb.scala" "../../../marking/drumb_test1.scala") then echo " --> success" | tee -a $out marks=$(( marks + 1 )) @@ -74,7 +74,7 @@ echo " List(Some(0.20126676681483952), Some(0.9277165354330709))," | tee -a $out echo " List(Some(0.09141762603007778), Some(2.119679764725104)))" | tee -a $out - if (scala_assert "drumb.scala" "../drumb_test2.scala") + if (scala_assert "drumb.scala" "../../../marking/drumb_test2.scala") then echo " --> success" | tee -a $out marks=$(( marks + 1 )) @@ -93,7 +93,7 @@ echo " yearly_yield(IBM + BIDU, 04 - 08, 100, 3) - 210).abs <= 2 " | tee -a $out echo " investment(List(\"IBM\", \"BIDU\"), 2004 to 2008, 100) - 298).abs <= 10" | tee -a $out - if (scala_assert "drumb.scala" "../drumb_test3.scala") + if (scala_assert "drumb.scala" "../../../marking/drumb_test3.scala") then echo " --> success" | tee -a $out marks=$(( marks + 1 ))