
February 21st 2008 Popeyes
My friend Andrew sent me a link to a funny post about Popeyes chicken tenders. After chuckling a bit, the post made me think: How easy would it be to write a program in Haskell that would calculate the number of dipping sauces you’d receive from an order of n chicken tenders?
Extraordinarily easy, of course. Below is the Haskell program for doing just that:
popeyes :: Integer -> Integer
popeyes n | n > 3 = 1
| otherwise = 2 ^ (div n 3 - 1)