
I need the functions to be defined using Haskell language.
med3 a b c returns the median value of the set {a,b,c}.
med3 :: Integer -> Integer -> Integer -> Integer
med3 a b c = undefined
-- ghci> med3 1 8 17
-- 8
-- ghci> med3 25 (-1) 6
-- 6
-- ghci> med3 2 11 2
-- 2
blur :: [Double] -> [Double]
blur l = undefined
-- [2.0,4.0,6.0]
-- ghci> blur [7, 8, 2.5, 16, 45, 45, 0]
-- [7.5,5.25,9.25,30.5,45.0,22.5]
-- ghci> blur []
-- []
-- ghci> blur [1]
-- []

`med3` Function Algorithm:
1. Define a function called `med3` that takes three Integer arguments: `a`, `b`, and `c`.
2. In the function, use pattern matching and guards to handle different cases based on the values of `a`, `b`, and `c`.
3. Check which of the three values, `a`, `b`, or `c`, is the median.
- If `b` is the median, return `b`.
- If `a` is the median, return `a`.
- If `c` is the median, return `c`.
`blur` Function Algorithm:
1. Define a function called `blur` that takes a list of Doubles, denoted as `l`.
2. Use pattern matching to define different cases for the input list:
- If the input list `l` is empty (`[]`), return an empty list (`[]`) since there are no elements to blur.
- If the input list `l` has only one element (i.e., `[x]`), return an empty list (`[]`) because there are not enough elements to form pairs for blurring.
- For the general case, where `l` has at least two elements:
- Deconstruct the list into the first element `x` and the second element `y`, and the rest of the list (`rest`).
- Calculate the average of `x` and `y` by adding them together and dividing by 2: `(x + y) / 2`.
- Prepend the calculated average to the result of recursively calling the `blur` function on the rest of the list `rest`.
3. Continue this process recursively until the list is reduced to one or zero elements, appending averages of adjacent pairs along the way.
4. The function returns a list of averages.
Step by stepSolved in 4 steps with 1 images

- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





