Question: In F# Language, please provide sample output. Write a function downTo : int -> int list so that downTo n returns the n-element list [n;

In F# Language, please provide sample output.

Write a function

downTo : int -> int list

so that downTo n returns the n-element list [n; n-1; . . .; 1].

You must use if-then-else expressions to define the function.

Secondly define the function downTo2 having same semantics as downTo. This time you must use pattern matching.

Write another function

removeOddIdx : int list -> int list

so that removeOddIdx xs removes the odd-indexed elements from the list xs:

removeOddIdx [x0; x1; x2; x3; x4; ...] = [x0; x2; x4; ...]

removeOddIdx [] = []

removeOddIdx [x0] = [x0]

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!