Skip to content

Instantly share code, notes, and snippets.

@p3t0r
Created February 24, 2009 21:32
Show Gist options
  • Save p3t0r/69796 to your computer and use it in GitHub Desktop.
Save p3t0r/69796 to your computer and use it in GitHub Desktop.
def priceCalculator(tax: Double=>Double, reduction: Double=>Double, price:Double, shipping:Double) = tax(reduction(price + shipping))
def reducationCalculator(price:Double) = if(price > 50) price - 10 else price
val withTax = priceCalculator(_*1.19,_: Double=>Double, _:Double, _:Double)
val withTaxAndReduction = withTax(reducationCalculator(_), _:Double, _:Double)
println(withTaxAndReduction(97.5, 2.5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment