Skip to content

Instantly share code, notes, and snippets.

@acfoltzer
Created January 12, 2012 01:15
Show Gist options
  • Save acfoltzer/1597856 to your computer and use it in GitHub Desktop.
Save acfoltzer/1597856 to your computer and use it in GitHub Desktop.
Fix at work
fix :: (a -> a) -> a
fix f = f (fix f)
fact' :: (Integer -> Integer) -> Integer -> Integer
fact' = \bang -> \n -> if n == 0 then 1 else n * bang (n-1)
fact :: Integer -> Integer
fact = fix fact'
onehundredandtwenty :: Integer
onehundredandtwenty = fact 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment