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

** I Need help with the following questions on my F# Review with explanation ple

ID: 3881457 • Letter: #

Question

** I Need help with the following questions on my F# Review with explanation please! :) **

8) Let F# function foo be defined as follows: let rec foo = function | (xs, []) -> xs | (xs, y::ys) -> foo (xs@[y], ys) If foo is supposed to append its two list parameters, which of the following is true? Select one:

a) foo fails Step 1 of the Checklist for Programming with Recursion.

b) foo fails Step 2 of the Checklist for Programming with Recursion.

c) foo fails Step 3 of the Checklist for Programming with Recursion.

d) foo satisfies all three steps of the Checklist for Programming with Recursion.

9) Which of the following is the type that F# infers for (fun f -> f 17)? Select one:

a) ('a -> 'b) -> 'b

b) (int -> int) -> int

c) (int -> 'a) -> 'a

d) ('a -> 'a) -> 'a 10)

Which of the following has type int -> int list? Select one:

a) (@) [5]

b) [fun x -> x+1]

c) fun x -> 5::x

d) fun x -> x::[5]

Explanation / Answer

9) Which of the following is the type that F# infers for (fun f -> f 17)? Select one:

Option:C

Answer: (int -> 'a) -> 'a

Which of the following has type int -> int list? Select one:

Option:B

Answer:b) [fun x -> x+1]