diff -r 34e901c529ce -r 370c0647a9bf handouts/scala-ho.tex --- 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: