Question: Implement the following function using recursive functions in ML ( Meta Language). (a) Power(x, n) that calculates the nth power of x. (b) Mul(m, n)

Implement the following function using recursive functions in ML (Meta Language).

(a) Power(x, n) that calculates the nth power of x.

(b) Mul(m, n) = m*n without the use of * operator for real valued m and integer n.

(c) Length(list) that calculates the number of elements in a list. The function should take arguments of any list type.

(d) Present(a, list) that returns true if a is an element of a list else returns false.

e) a recursive function in ML that reads an input list of integers (from 0 to 9) and returns a true if the list contains a sequence of 325 anywhere in list as a sequence of consecutive elements. For example, [3, 2, 5, 2, 3, 4], [1, 3, 2, 5], [1, 2, 3, 3, 2, 5], [2, 3, 2, 5, 5] are all those inputs for which this function should return true. Similary, [1, 3, 1, 2, 5] and [3, 2, 0, 5] should return false. You may use the function in Part (d) in it.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!