# HG changeset patch # User Christian Urban # Date 1565046754 -3600 # Node ID b9eaa5cdec4a240a16dc472a84b61669881033e9 # Parent 86a85865e772c6664981b2c9f5cffe4c1e5ca2c5 updated diff -r 86a85865e772 -r b9eaa5cdec4a handouts/pep-ho.pdf Binary file handouts/pep-ho.pdf has changed diff -r 86a85865e772 -r b9eaa5cdec4a handouts/pep-ho.tex --- a/handouts/pep-ho.tex Mon Aug 05 20:14:06 2019 +0100 +++ b/handouts/pep-ho.tex Tue Aug 06 00:12:34 2019 +0100 @@ -323,7 +323,7 @@ \centering\includegraphics[scale=0.5]{../pics/cpu1.png} \end{tabular} \end{center} -\caption{The code of the ``main'' loops in my Mandelbrot program. +\caption{The code of the ``main'' loops in my version of the mandelbrot program. The parallel version differs only in \texttt{.par} being added to the ``ranges'' of the x and y coordinates. As can be seen from the CPU loads, in the sequential version there is a lower peak for an extended period, @@ -642,7 +642,7 @@ The very charming feature of Scala is that such maps or for-comprehensions can be written for any kind of data collection, such as lists, sets, vectors, options and so on. -For example if we instead compute the reminders modulo 3 of +For example if we instead compute the remainders modulo 3 of this list, we can write \begin{lstlisting}[numbers=none] @@ -651,7 +651,7 @@ \end{lstlisting} \noindent If we, however, transform the numbers 1 to 8 not -into a list, but into a set, and then compute the reminders +into a list, but into a set, and then compute the remainders modulo 3 we obtain \begin{lstlisting}[numbers=none] @@ -701,7 +701,7 @@ complication: In the examples above we always wanted to transform one list into another list (e.g.~list of squares), or one set into another set (set of numbers into set of -reminders modulo 3). What happens if we just want to print out +remainders modulo 3). What happens if we just want to print out a list of integers? Then actually the for-comprehension needs to be modified. The reason is that \code{print}, you guessed it, does not produce any result, but only produces @@ -734,7 +734,7 @@ square = ...} ) and also what is called in Scala a \emph{string interpolation}, written \code{s"..."}. The latter is for printing out an equation. It allows me to refer to the -integer values \code{n} and \code{square\_n} inside a string. +integer values \code{n} and \code{square} inside a string. This is very convenient for printing out ``things''. The corresponding map construction for functions with @@ -807,7 +807,7 @@ \noindent is for a triple (a tuple with three components---two integers and a string). Tuples are helpful if you want to define functions with multiple results, say the function -returning the quotient and reminder of two numbers. For this +returning the quotient and remainder of two numbers. For this you might define: