Skip to content

Instantly share code, notes, and snippets.

@qoelet
Created November 22, 2013 05:57
Show Gist options
  • Save qoelet/7595492 to your computer and use it in GitHub Desktop.
Save qoelet/7595492 to your computer and use it in GitHub Desktop.
-- the diff() function from R
diff :: (Num a) => [a] -> [a]
diff [] = []
diff (_:[]) = []
diff (x:y:xs) = (y - x) : diff (y:xs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment