diff --git a/Assets/Solutions/Mid-Term/Mid-Term.md b/Assets/Solutions/Mid-Term/Mid-Term.md index 5c5094e..ba2ac88 100644 --- a/Assets/Solutions/Mid-Term/Mid-Term.md +++ b/Assets/Solutions/Mid-Term/Mid-Term.md @@ -3,6 +3,7 @@ ![](https://img.shields.io/badge/Lecture-2-orange) ![](https://img.shields.io/badge/Practical-3-orange) ![](https://img.shields.io/badge/Credits-3-orange) ## Mid-Term Question Paper with Solutions +![](https://img.shields.io/badge/MidTerm_Exam-24th_Apr-orange) #### 1. Write the _type signature_ of the below functions. (a) **zip :: [a] → [b] → [(a, b)]**
@@ -39,10 +40,10 @@ Successfully solved by [Aishwarya G](), [Dyanesh S](), [Aravind S](), [Ashwin An (d) [ x^2 | x ← [1..10], even x ]
**Solution:**
-(a)
-(b)
-(c)
-(d)
+(a) **map reverse (filter (even . length) strs)**
+(b) **map length (filter (\word → length word > 10) words)**
+(c) **map (\x -> (x, 6 - x)) (filter (\x -> x + (6 - x) == 6) [1..5])**
+(d) **map (^2) (filter even [1..10])**
#### 6. Write a Haskell code to generate the below HTML file with custom _body_ and _footer_ as mentioned. - body = "Mid-Term Examination" @@ -72,7 +73,11 @@ Successfully solved by [Aishwarya G](), [Dyanesh S](), [Aravind S](), [Ashwin An **Solution:** ``` +html bcontent fcontent = "Haskell Generated HTML" <> body bcontent fcontent <> "" +body bcontent fcontent = "

Content generated by Haskell:

" <> bcontent <> "
" +main = do + putStrLn(html "Mid-Term Examination" "19-March-2024") ``` #### 7. Implement a Queue with the isEmpty, enqueue, dequeue and front function using Haskell data type with Maybe.