Skip to content

Instantly share code, notes, and snippets.

@eccstartup
Created March 20, 2017 02:10
Show Gist options
  • Save eccstartup/bf08a9b8b508e45fb8beaafbcdf866c7 to your computer and use it in GitHub Desktop.
Save eccstartup/bf08a9b8b508e45fb8beaafbcdf866c7 to your computer and use it in GitHub Desktop.
{-# LANGUAGE NPlusKPatterns #-}
f1 0 = 0
f1 (n+1) = n+1 + f1 n
f2 0 = 0
f2 (n+2) = n+2 + f2 (n+1)
@eccstartup
Copy link
Author

*Main> f1 2
3
*Main> f2 2
*** Exception: nplusk.hs:(6,1)-(7,25): Non-exhaustive patterns in function f2

*Main> f2 1
*** Exception: nplusk.hs:(6,1)-(7,25): Non-exhaustive patterns in function f2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment