Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am guspower on github.
  • I am guspower (https://keybase.io/guspower) on keybase.
  • I have a public key ASAqsBEJ6ZXXygfaXu3nNBvFpwbGVwauHKeRt6NqHlXJ9Qo

To claim this, I am signing this object:

@guspower
guspower / curried-closure.groovy
Created November 25, 2013 11:45
A few curried closures, groovy style
def calculatePrice = { float cost, float margin, float vat ->
(cost + margin) * (100 + vat)/100
}
def standardRatePrice = calculatePrice.rcurry(20.0f)
def reducedRatePrice = calculatePrice.rcurry(5.0f)
def zeroRatePrice = calculatePrice.rcurry(0.0f)
void run() {
println standardRatePrice(10.0, 2.5)