more material
authorChristian Urban <christian dot urban at kcl dot ac dot uk>
Wed, 03 Sep 2014 11:01:49 +0100
changeset 237 370c0647a9bf
parent 236 34e901c529ce
child 238 527fdb90fffe
more material
handouts/ho01.pdf
handouts/ho01.tex
handouts/scala-ho.pdf
handouts/scala-ho.tex
langs.sty
Binary file handouts/ho01.pdf has changed
--- a/handouts/ho01.tex	Mon Sep 01 18:05:39 2014 +0100
+++ b/handouts/ho01.tex	Wed Sep 03 11:01:49 2014 +0100
@@ -1,18 +1,14 @@
 \documentclass{article}
-\usepackage{hyperref}
-\usepackage{amssymb}
-\usepackage{amsmath}
-\usepackage[T1]{fontenc}
+\usepackage{../style}
 \usepackage{../langs}
 
-\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}%
 
 
 \begin{document}
 
 \section*{Handout 1}
 
-This course is about the processing of strings. Lets start with what we mean by \emph{strings}. Strings
+This module is about the processing of strings. Lets start with what we mean by \emph{strings}. Strings
 (they are also sometimes referred to as \emph{words}) are lists of characters drawn from an \emph{alphabet}. 
 If nothing else is specified, we usually assume 
 the alphabet consists of just the lower-case letters $a$, $b$, \ldots, $z$. Sometimes, however, we explicitly
Binary file handouts/scala-ho.pdf has changed
--- a/handouts/scala-ho.tex	Mon Sep 01 18:05:39 2014 +0100
+++ b/handouts/scala-ho.tex	Wed Sep 03 11:01:49 2014 +0100
@@ -604,12 +604,20 @@
 
 
 \noindent
-Since this function returns a pair of integers, its type
-needs to be \code{(Int, Int)}. 
+Since this function returns a pair of integers, its 
+return type needs to be \code{(Int, Int)}. Incidentally,
+this is also the input type of this function. Notice it takes
+\emph{two} arguments, namely \code{m} and \code{n}, both
+of which are integers. They are ``packaged'' in a pair.
+Consequently the complete type of \code{quo_rem} is
+
+\begin{lstlisting}[language=Scala, numbers=none]
+(Int, Int) => (Int, Int)
+\end{lstlisting}
 
 Another special type-constructor is for functions, written
-as the arrow \code{=>}. For example, the type \code{Int =>
-String} is for a function that takes an integer as argument
+as the arrow \code{=>}. For example, the type 
+\code{Int => String} is for a function that takes an integer as argument
 and produces a string. A function of this type is for instance
 
 
@@ -899,6 +907,10 @@
 \item \url{https://www.youtube.com/user/ShadowofCatron}
 \end{itemize}
 
+\noindent There is also a course at Coursera on Functional
+Programming Principles in Scala by Martin Odersky, the main
+developer of the Scala language.
+
 While I am quite enthusiastic about Scala, I am also happy to
 admit that it has more than its fair share of faults. The
 problem seen earlier of having to give an explicit type to
@@ -936,6 +948,8 @@
 you do not want, stick with the language you are most familiar
 with.
 
+
+
 \end{document}
 
 %%% Local Variables: 
--- a/langs.sty	Mon Sep 01 18:05:39 2014 +0100
+++ b/langs.sty	Wed Sep 03 11:01:49 2014 +0100
@@ -11,7 +11,7 @@
 
 
 \lstdefinelanguage{Scala}{
-  keywords={abstract,case,catch,class,def,%
+  morekeywords={abstract,case,catch,class,def,%
     do,else,extends,false,final,finally,%
     for,if,implicit,import,match,mixin,%
     new,null,object,override,package,%
@@ -51,10 +51,11 @@
 	showspaces=false,
 	showstringspaces=false,
         xleftmargin=8mm,
-        emphstyle=\color{codeblue}\bfseries}
+        emphstyle=\color{codeblue}\bfseries,
+        keepspaces}
 
 \lstset{language=Scala,
         style=mystyle}
 
 
-\newcommand{\code}[1]{{\lstinline!#1!}}
+\newcommand{\code}[1]{{\lstinline{#1}}}