Skip to content

Instantly share code, notes, and snippets.

@bradparker
Last active April 5, 2016 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradparker/1af207d01808300186501f6dc361353d to your computer and use it in GitHub Desktop.
Save bradparker/1af207d01808300186501f6dc361353d to your computer and use it in GitHub Desktop.
decrementBy
decrementBy :: (Ord a, Num a) => a -> a -> a
decrementBy n d
| n < d = 0
| otherwise = n - d
--- 1 `decrementBy` 2
--- 0
--- 2 `decrementBy` 1
--- 1
--- pi `decrementBy` 1
--- 2.141592653589793
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment