Skip to content

Instantly share code, notes, and snippets.

@jdh30
Last active January 29, 2017 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdh30/fa0c58d4d7fe4cffd335b026b7d43419 to your computer and use it in GitHub Desktop.
Save jdh30/fa0c58d4d7fe4cffd335b026b7d43419 to your computer and use it in GitHub Desktop.
let accountFactor = function
| `Simple -> 0.9
| `Valuable -> 0.7
| `MostValuable -> 0.5
let loyaltyFactor years =
1.0 -. float(min years 5) /. 100.0
let applyDiscount price = function
| `Unregistered -> price
| `Registered(kind, years) ->
price *. accountFactor kind *. loyaltyFactor years
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment