From f9002db26ed1b2ad53e8732f13cfdf2024363bbe Mon Sep 17 00:00:00 2001 From: CasperHro <0931371@hr.nl> Date: Sun, 24 Jun 2018 00:05:53 +0200 Subject: [PATCH] Changed return type of eval functions In the text it's said that the eval should "simply returns the atomic value". In the solution code this is also a number type. --- Exercises/Lesson 3/unit3- exercises.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Exercises/Lesson 3/unit3- exercises.tex b/Exercises/Lesson 3/unit3- exercises.tex index 7da6013..d8cc6d7 100644 --- a/Exercises/Lesson 3/unit3- exercises.tex +++ b/Exercises/Lesson 3/unit3- exercises.tex @@ -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] @@ -70,7 +70,7 @@ }}\\ \exercise{ - \functionEx{eval}{(expr1: Expr) => (stack: List>): Expr}{ + \functionEx{eval}{(expr1: Expr) => (stack: List>): 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. }}\\