Question: Creating a function in Ocaml that takes a derivative of a list of integers. Shown below is the actual question given: list_deriv : int list
Creating a function in Ocaml that takes a derivative of a list of integers. Shown below is the actual question given:
list_deriv : int list -> int list: the list_deriv function takes the "derivative" of a list of integers by taking n integers ad returning the list of n-1 differences between the consecutive integers, so list_deriv [ 0; 8; 14; 3 ] evaluates to [8; 6; -11] and list_deriv [ 0; 1; 1; 2; 3; 5; 8 ] evaluates to [1; 0; 1; 1; 2; 3]. You might find it cleanest to use a nested helper function to deal with the core logic while an outer match takes care of the two special cases that could arise.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
