Last active
August 29, 2015 14:08
-
-
Save jacobstanley/d7108dd60c4af73d2a51 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
| -- Solve for the maximum/minimum number of menu items adding up to $15.05 | |
| -- http://xkcd.com/287/ | |
| xkcd :: Direction -> Program String String IntDouble | |
| xkcd dir = program dir | |
| ( z1 mf .+. | |
| z1 ff .+. | |
| z1 ss .+. | |
| z1 hw .+. | |
| z1 ms .+. | |
| z1 sp ) | |
| ( z mf mfp .+. | |
| z ff ffp .+. | |
| z ss ssp .+. | |
| z hw hwp .+. | |
| z ms msp .+. | |
| z sp spp :== con 1505 ) | |
| [ lowerZ 0 mf | |
| , lowerZ 0 ff | |
| , lowerZ 0 ss | |
| , lowerZ 0 hw | |
| , lowerZ 0 ms | |
| , lowerZ 0 sp | |
| ] | |
| where | |
| (mf, mfp) = ("mixed-fruit", 215) | |
| (ff, ffp) = ("french-fries", 275) | |
| (ss, ssp) = ("side-salad", 335) | |
| (hw, hwp) = ("hot-wings", 355) | |
| (ms, msp) = ("mozzarella-sticks", 420) | |
| (sp, spp) = ("sampler-plate", 580) |
jacobstanley
commented
Nov 2, 2014
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
