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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started