From 01e057e9eb41402cfc413d88a467f805d7763031 Mon Sep 17 00:00:00 2001 From: Niklas Heim Date: Wed, 8 May 2024 20:22:59 +0200 Subject: [PATCH] solutions --- labs/lab10.md | 2 -- labs/lab11.md | 9 ++++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/labs/lab10.md b/labs/lab10.md index 0ef3a4e..0557694 100644 --- a/labs/lab10.md +++ b/labs/lab10.md @@ -304,7 +304,6 @@ of `xs` together with subsequences of `xs` extended by `x`. To produce the sorte `merge` function. ::: - diff --git a/labs/lab11.md b/labs/lab11.md index d1a5e39..2dda2bf 100644 --- a/labs/lab11.md +++ b/labs/lab11.md @@ -215,6 +215,8 @@ Write a function `eval :: Expr Bool -> Bool` evaluating a given Boolean expressi Logical operations negation, conjunction and disjunction can be respectively computed by `not, &&, ||`. The last two are infix operators. ::: + ## Task 2 The type constructor `Expr` from the previous task can be made into an instance of `Functor` as follows: @@ -252,12 +255,14 @@ subst :: Functor f => [String] -> f String -> f Bool ``` taking a list of strings (variables) and a data structure over strings returning the same data structure where the strings (variables) in the input list are replaced by `True` and the rest by `False`. Use the lifting by `fmap`. + Next, apply the function `subseqs :: [a] -> [[a]]` from the previous lab returning a list of all sublists of a given list. ```haskell @@ -277,6 +282,7 @@ such that the Boolean expression resulting from the replacing atoms by the respe To check that there exists an evaluation satisfying a formula or if all evaluations satisfy the formula, use the functions `or`, `and` respectively. These functions are applicable to any list of Boolean values. ::: +