Forward difference
Forward difference
You are encouraged to solve this task according to the task description, using any language you may know.
You are encouraged to solve this task according to the task description, using any language you may know.
Provide code that produces a list of numbers which is the n-th order forward difference, given a non-negative integer (specifying the order) and a list of numbers. See Wolfram MathWorld:Forward Difference.
J
Of the many ways to code this in J, a particularly clear and concise solution is:
fd=: (}. - }:) ^: