Guys I am looking for the answers for these questions for my assignment. Can some one please help ?



Q.1: The polymorphic curried function delFirst takes two arguments, a predicate (Boolean-valued function) p
and a list xs. It returns a list identical to xs except that the first element satisfying p is omitted; if no such element
exists, then it raises an exception. Code this function in ML


Q.2: Use the function delFirst to express the polymorphic function delFirstElt, where delFirstElt x xs returns a
list identical to xs except that it omits the first occurrence of x.

Q.3: A list ys is a permutation of another list xs if ys is obtained by rearranging the elements of xs. For example,
[2, 1, 2, 1] is a permutation of [2, 2, 1, 1]. Code an ML function to determine whether one list is a permutation of
another.


Qns 4: (e) A list ys is a generalized permutation of xs if ys is obtained by rearranging the Elements of xs, where
one element of xs is specially treated: it may appear any number of times (including zero) in ys. For example, [1,
2, 1] is a generalized permutation of [1, 2] but [1, 2, 2, 1] is not because two elements (1 and 2) appear the wrong
number of times in it. Code an ML function to determine whether one list is a generalized permutation of
another.