Question: Here is a function definition in ML: fun whatAml (n, nil) = nil whatAml (0, h:: t) = h :: whatAml(1,t) whatAml (1, h
Here is a function definition in ML: fun whatAml (n, nil) = nil whatAml (0, h:: t) = h :: whatAml(1,t) whatAml (1, h :: t) = whatAml(0,t); (a) Show every step of the evaluation process, give the results obtained by evaluating the following: whatAml (0, [6, 5, 4, 3, 2, 1]) (b) Describe the effect of the function whatAml in general. (c) The language ML provides type inference. What type would be inferred for the function whatAml? Explain your answer
Step by Step Solution
There are 3 Steps involved in it
a To evaluate the function whatAml 0 6 5 4 3 2 1 well go through each step of the evaluation process Step 1 Pattern matching with the first case whatAml n nil nil does not match because the second arg... View full answer
Get step-by-step solutions from verified subject matter experts
