--- a/hws/hw08.tex Fri Sep 16 12:52:21 2022 +0100
+++ b/hws/hw08.tex Thu Sep 29 20:54:02 2022 +0100
@@ -1,5 +1,6 @@
\documentclass{article}
\usepackage{../style}
+\usepackage{../langs}
\usepackage{../graphics}
\begin{document}
@@ -18,6 +19,22 @@
\item What is the main difference between the Java assembler
(as processed by Jasmin) and Java Byte Code?
+\item Consider the following Scala snippet. Are the two functions
+\texttt{is\_even} and \texttt{is\_odd} tail-recursive?
+
+\begin{lstlisting}[numbers=none]
+def iseven(n: Int) : Boolean = {
+ if (n == 0) true else isodd(n - 1)
+}
+
+def isodd(n: Int) : Boolean = {
+ if (n == 0) false
+ else if (n == 1) true else iseven(n - 1)
+}
+\end{lstlisting}
+
+Do they cause stack-overflows when compiled to the JVM (for example by Scala)?
+
\item Explain what is meant by the terms lazy evaluation and eager
evaluation.