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

Write an ML (SML; Standard Meta Language) High-order function philter(f,x,L) tha

ID: 3591803 • Letter: W

Question

Write an ML (SML; Standard Meta Language) High-order function philter(f,x,L) that takes a function f and an element x and returns the list of all those elements y on list L such that f(x,y) = true.
Write an ML (SML; Standard Meta Language) High-order function philter(f,x,L) that takes a function f and an element x and returns the list of all those elements y on list L such that f(x,y) = true.
Write an ML (SML; Standard Meta Language) High-order function philter(f,x,L) that takes a function f and an element x and returns the list of all those elements y on list L such that f(x,y) = true.

Explanation / Answer

Ans

in this we take a function of the quick sort

fun qsort(nil) = nil

qsort (x::y) = split (High , Low)

= split(x,y)

append(qsort(Low) , x ::qsort(High))

end

split(X , nil) = (nil , nil)

split( X, (x :: y) = let value (a ,b)

= split( X,y)

if (x<X)

then ((x :: a),b)

else( a, (x :: b))

end;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote