Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can anyone solve any (if not all) of the following in Elm language please? Do th

ID: 3774953 • Letter: C

Question

Can anyone solve any (if not all) of the following in Elm language please?

Do the following programming exercises. You can put all the functions in the same Elm file. Write an Elm function sort 3 that takes 3 integers and returns a 3-tuple with the values in descending order (i.e., largest first). Write an Elm function sumSqBig that takes 3 integers and returns the sum of the squares of the two larger integers. (You may use sort 3.) Write a Elm function ad j pairs that takes a polymorphic list and returns the list of all pairs of adjacent elements. For example, ad j pairs [2, 1, 11, 4] returns [(2, 1), (1, 11), (11, 4)]. Write an Elm function mean that takes a list of numbers and returns the mean (i.e., average) value for the list. Write an Elm function merge that takes two increasing lists of integers and merges them into a single increasing list (without any duplicate values). A list is increasing if every element is less than (

Explanation / Answer

Part1:

import Html exposing (text)

sort3 a b c=
let
d =
max (max a b) c
e =
min (min a b) c
f =
a + b + c - d - e
in (,,) d f e
  
main =
text (toString (sort3 10 5 20))
  

--######################################################################

Part 2:

import Html exposing (text)

sort3 a b c=
let
d =
max (max a b) c
e =
min (min a b) c
f =
a + b + c - d - e
in (,,) d f e

sumSqBig a b c=
let
d =
fst (sort3 a b c)
e =
snd (sort3 a b c)
in d*d + e*e

main =
text (toString (sumSqBig 10 5 20))
  

--###############################################################################

Part 4:

import Html exposing (text)
import List exposing (sum,length)
mean list=
(sum list)/toFloat (length list)
main =
text (toString (mean [2,1,11,4]))
  

TOO MANY SUBPARTS IN A QUESTION. PLEASE MAKE ANOTHER QUESTION AND ADD A COMMENT HERE. THANKS.