Forward difference

From Rosetta Code
Revision as of 20:12, 14 December 2007 by rosettacode>TBH (Created page. Included initial solution, in J.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Task
Forward difference
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=: (}. - }:) ^: