From 38932c677220212dffcab062fa5ec1bb51749b49 Mon Sep 17 00:00:00 2001 From: Edoardo La Greca Date: Fri, 4 Jul 2025 17:57:00 +0200 Subject: add missing formatting for comments of exercises of lecture 3 --- lec03/Golf.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lec03/Golf.hs b/lec03/Golf.hs index f4b988b..412ab22 100644 --- a/lec03/Golf.hs +++ b/lec03/Golf.hs @@ -5,7 +5,7 @@ import Data.Maybe -- Exercise 1 -- Explanation: --- takeNth takes the nth value of a list without crashing. First, it drops all +-- `takeNth` takes the nth value of a list without crashing. First, it drops all -- the first `n - 1` elements from the list. Then, it takes the desired element -- and returns it as a list. If the element can't be found, it returns an empty -- list. This function is total and can be thought of as the total version of @@ -14,7 +14,7 @@ takeNth :: [a] -> Int -> [a] takeNth l n = take 1 $ drop (n-1) l -- Explanation: --- skips first maps all values in `nl`, defined as all values from 1 to the +-- `skips` first maps all values in `nl`, defined as all values from 1 to the -- length of the list (excluded), to `concatMap`, which is the same as `concat -- (map ...)`. `concatMap` maps again the same array, this time multiplied by -- each value `n` coming from the outer map, to takeNth of the given list `l` @@ -29,7 +29,7 @@ skips l = map (\n -> concatMap (takeNth l . (*n)) nl) nl -- Exercise 2 -- Explanation: --- localMaxima is defined in two cases. In the first case, the argument of the +-- `localMaxima` is defined in two cases. In the first case, the argument of the -- function is a list with at least 3 elments. Depending on the value of the -- first three elements, checked through two guards, the second is either -- included or excluded from the resulting list. In particular, the first guard -- cgit v1.2.3