Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
The answer for this question is that there is something wrong with the expression of the first guard of this function below: congratulations :: [(String, Int)] -> [String] congratulations [] =...
Question
haskell
#2: Post edited
- The answer for this question is that there is something wrong with the expression of the first guard of this function below:
- ```
- congratulations :: [(String, Int)] -> [String]
- congratulations [] = []
- congratulations ((name,mark):rest)
- | mark > 40 = name
- | otherwise = congratulations rest
- ```
What should be the correct expression for the first guard of the function?
- The answer for this question is that there is something wrong with the expression of the first guard of this function below:
- ```
- congratulations :: [(String, Int)] -> [String]
- congratulations [] = []
- congratulations ((name,mark):rest)
- | mark > 40 = name
- | otherwise = congratulations rest
- ```
- What should be the correct expression for the first guard of the function and why?
#1: Initial revision
Haskell revision question.
The answer for this question is that there is something wrong with the expression of the first guard of this function below: ``` congratulations :: [(String, Int)] -> [String] congratulations [] = [] congratulations ((name,mark):rest) | mark > 40 = name | otherwise = congratulations rest ``` What should be the correct expression for the first guard of the function?