diff options
author | Edoardo La Greca | 2025-07-04 17:57:00 +0200 |
---|---|---|
committer | Edoardo La Greca | 2025-07-04 17:57:00 +0200 |
commit | 38932c677220212dffcab062fa5ec1bb51749b49 (patch) | |
tree | e6ca5c09f2a7e2e88a7ab4e4b0e687f137adc870 | |
parent | 96d76454ba52151f908b2edbe30a1d5f9568bc87 (diff) |
add missing formatting for comments of exercises of lecture 3
-rw-r--r-- | lec03/Golf.hs | 6 |
1 files 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 |