I need your help on this please Write an Elm function merge

I need your help on this please..

*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 (<) its successors. Successor means an element that occurs later in the list, i.e., away from the head.

Hint: For merge xs ys, you might want to consider a pattern match on (xs,ys).

Solution

(def(functionheremerge-sort before? vs)

(letrec

((merge(abs(x s ys)

   (cond((null? xs ) ys)

             (( null? ys) xs)

             (( before? ( car xs) ( car ys)))

          ( else(cons( car ys) ( merge xs (cdr ys)))->to merget the lists

Now we will sort the two lists :

(alts(abs(ws)

      (foldr(abs ( w   createlistpair)

                  (pair   (snd    createlistpair) (cons( w   ( fst createlistpair)))))

                  (pair   nil   nil)

                   ws)))

(ms (abs (zs)

   (if(scor   (null? zs )    ( null?   (cdr zs)))

    zs

(let   ((letssplit (alts   zs)))

(merge   ( ms   (fst   split))   (os   ( snd split))))))))

(os    vs)))

I need your help on this please.. *Write an Elm function merge that takes two increasing lists of integers and merges them into a single increasing list (withou

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site