From 767600584450fafefc1fd4dab4d8e0dcbeec2d0e Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 14 Mar 2024 18:15:35 +0100 Subject: [PATCH] Solve task 03 --- .vscode/tasks.json | 4 ++++ Exercises/exercise-1/Code/C_TypesTodo.hs | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 .vscode/tasks.json diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..7dba619 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,4 @@ + +{ + "version": "2.0.0" +} diff --git a/Exercises/exercise-1/Code/C_TypesTodo.hs b/Exercises/exercise-1/Code/C_TypesTodo.hs index 41d9057..65bb8c4 100644 --- a/Exercises/exercise-1/Code/C_TypesTodo.hs +++ b/Exercises/exercise-1/Code/C_TypesTodo.hs @@ -57,7 +57,7 @@ Greet Obi-Wan and Han, each with a phrase like e.g. "Hello Obi-Wan". Use 'map' and 'first'. -} greetings :: [String] -greetings = error "fixme" +greetings = map (\x -> "Hello " ++ firstName x) [han, obiWan] {- "Setters" Values of a record can be changed with the syntax below. @@ -125,10 +125,10 @@ data MyList a [1,2,3] as 'MyList' -} list :: MyList Integer -list = +list = Cons 1 - (Cons + (Cons 2 (Cons 3 @@ -142,8 +142,8 @@ list = -} data Shape = Circle { radius :: Float } - | Rectangle + | Rectangle { len :: Float , width :: Float } - +