Skip to content

Instantly share code, notes, and snippets.

View keybase.md

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 Nov 25, 2013
A few curried closures, groovy style
View curried-closure.groovy
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)