--- a/handouts/ho02.tex Mon Feb 13 23:22:45 2017 +0000
+++ b/handouts/ho02.tex Wed Mar 15 01:24:39 2017 +0000
@@ -3,7 +3,8 @@
\usepackage{../langs}
\usepackage{../graphics}
\usepackage{../data}
-
+\usepackage{lstlinebgrd}
+\definecolor{capri}{rgb}{0.0, 0.75, 1.0}
\begin{document}
\fnote{\copyright{} Christian Urban, King's College London, 2014, 2015, 2016, 2017}
@@ -54,8 +55,8 @@
x label style={at={(1.1,0.05)}},
ylabel={\small time in secs},
enlargelimits=false,
- xtick={0,3000,...,9000},
- xmax=10000,
+ xtick={0,2500,...,11000},
+ xmax=12000,
ymax=35,
ytick={0,5,...,30},
scaled ticks=false,
@@ -86,9 +87,10 @@
axis lines=left,
width=5cm,
height=5cm,
- legend entries={Java},
+ legend entries={Java, Python},
legend pos=north west,
legend cell align=left]
+\addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};
\addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
\end{axis}
\end{tikzpicture}
@@ -461,7 +463,9 @@
for \pcode{matches} are shown in Figure~\ref{scala1}.
\begin{figure}[p]
-\lstinputlisting{../progs/app5.scala}
+ \lstinputlisting[numbers=left,linebackgroundcolor=
+ {\ifodd\value{lstnumber}\color{capri!3}\fi}]
+ {../progs/app5.scala}
\caption{Scala implementation of the \textit{nullable} and
derivative functions. These functions are easy to
implement in functional languages, because their built-in pattern
@@ -581,8 +585,8 @@
x label style={at={(1.01,0.0)}},
ylabel={time in secs},
enlargelimits=false,
- xtick={0,100,...,1000},
- xmax=1100,
+ xtick={0,200,...,1100},
+ xmax=1200,
ytick={0,5,...,30},
scaled ticks=false,
axis lines=left,
@@ -600,8 +604,8 @@
\end{center}
\noindent Now we are talking business! The modified matcher
-can within 30 seconds handle regular expressions up to
-$n = 950$ before a StackOverflow is raised. Recall that Python and Ruby
+can within 25 seconds handle regular expressions up to
+$n = 1,100$ before a StackOverflow is raised. Recall that Python and Ruby
(and our first version, Scala V1) could only handle $n = 27$ or so in 30
seconds. There is no change for our second example
$(a^*)^* \cdot b$---so this is still good.
@@ -652,7 +656,9 @@
function introduced. Does this improve the speed? You bet!!
\begin{figure}[p]
-\lstinputlisting{../progs/app6.scala}
+\lstinputlisting[numbers=left,linebackgroundcolor=
+ {\ifodd\value{lstnumber}\color{capri!3}\fi}]
+ {../progs/app6.scala}
\caption{The simplification function and modified
\texttt{ders}-function; this function now
calls \texttt{der} first, but then simplifies