Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed return type of eval functions #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Exercises/Lesson 3/unit3- exercises.tex
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}}\\

\exercise{
\functionEx{eval}{(expr1: Expr): Expr}{
\functionEx{eval}{(expr1: Expr): number}{
The function allows to evaluate arithmetic expressions. An arithmetic expression is defined as a discriminated union with the following cases:

\begin{itemize}[noitemsep]
Expand All @@ -70,7 +70,7 @@
}}\\

\exercise{
\functionEx{eval}{(expr1: Expr) => (stack: List<Tuple<string, number>>): Expr}{
\functionEx{eval}{(expr1: Expr) => (stack: List<Tuple<string, number>>): number}{
Extend the previous version of the function \texttt{eval} by supporting also variables. Variables are another case of the union. Evaluating a variable means looking it up in the \texttt{stack}. A \texttt{stack} is a list of tuple mapping a variable name to its value. If the lookup is successful \texttt{eval} returns the value of the variable, otherwise it throws an error.
}}\\

Expand Down