diff --git a/semester4/fmfp/formal-methods-functional-programming-summary.pdf b/semester4/fmfp/formal-methods-functional-programming-summary.pdf index 3500d76..a7dc15b 100644 Binary files a/semester4/fmfp/formal-methods-functional-programming-summary.pdf and b/semester4/fmfp/formal-methods-functional-programming-summary.pdf differ diff --git a/semester4/fmfp/parts/02_typing/03_interpreter/02_eval.tex b/semester4/fmfp/parts/02_typing/03_interpreter/02_eval.tex index 2047ec6..86817f4 100644 --- a/semester4/fmfp/parts/02_typing/03_interpreter/02_eval.tex +++ b/semester4/fmfp/parts/02_typing/03_interpreter/02_eval.tex @@ -1,3 +1,13 @@ \newpage \subsection{Evaluation} -Evaluation is then done using tree traversal as we have already seen in the haskell section. +Evaluation is then done using tree traversal as we have already seen in the Haskell section. + + +\subsubsection{Lazy Evaluation} +Expressions are substituted before evaluation recursively until there are no more expressions to substitute, at which point the expression is evaluated. + +This can obviously lead to duplicated evaluation, i.e. a computation reoccurring. + +In Haskell, this is solved using sharing where the terms are represented in a directed graph. + +In pattern matching, the arguments are evaluated only as much as is needed to determine a pattern match.