Last active
December 12, 2015 09:19
-
-
Save naush/4750910 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- http://xkcd.com/287/ | |
| import Data.List | |
| order menu amount items | |
| | amount < 0 = [] | |
| | amount == 0 = [items] | |
| | otherwise = foldl (\meals (item, price) -> | |
| meals ++ order menu (amount - price) (item : items)) [] menu | |
| menu = [("Mixed Fruit", 215), ("French Fries", 275), ("Side Salad", 335), ("Hot Wings", 355), ("Mozzarella Sticks", 420), ("Sampler Plate", 580)] | |
| main = print (nub (map sort (order menu 1505 []))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment