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) = 

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

1 Expert Approved Answer
Step: 1 Unlock

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

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 Programming Questions!