Skip to content

Commit

Permalink
Updated Solutions for Q3
Browse files Browse the repository at this point in the history
  • Loading branch information
ramagururadhakrishnan authored May 13, 2024
1 parent 079c1bf commit 6e5d9e9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Assets/Solutions/Mid-Term/Mid-Term.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Mid-Term Question Paper with Solutions

#### 1. Write the \textit{type signature} of the below functions.
#### 1. Write the _type signature_ of the below functions.
(a) **zip :: [a][b][(a, b)]** <br/>
(b) **filter :: (a → Bool) → [a][a]**

Expand All @@ -29,6 +29,8 @@ pairswap:: [a] -> [a]
pairswap [ ] = [ ]
pairswap (x:y:xs) = y:x:pairswap(xs)
```
More variants of the solutions [here](Q3). <br/>
Successfully solved by [Aishwarya G](), [Dyanesh S](), [Aravind S](), [Ashwin Anand](), [S Dharmik](), [Gokul](), [M N Ravi](), [Yaswanth G](), [Nithin S](), [Siddharth Krishna](), [Rakshan K](), [PVS Ganasekhar](). [GH Hemsagar]() and [P Jivan Prasadd]() with minor mistakes.

#### 5. Write the expression equivalent to the following list comprehension using map and/or filter.
(a) [ reverse s | s ← strs, even (length s) ] <br/>
Expand Down Expand Up @@ -155,7 +157,7 @@ findMax (x:xs) = ???
```
**Solution:**
```
findMax :: [Int] \rightarrow Int
findMax :: [Int] -> Int
findMax [x] = x
findMax (x:xs) = max$ x (findMax xs)
```

0 comments on commit 6e5d9e9

Please sign in to comment.