makeAdder = ->(x){
    ->(y){x+y}
	}

add5 = makeAdder[5]
add10 = makeAdder[10]
add5[4]
add10[9]

=begin
counter = ->{
    privateCounter = 0
    changeBy = ->(val){privateCounter += val}
    
    return {
        increment: ->{changeBy(1)},
        decrement: ->{changeBy(-1)},
        value: ->{privateCounter}
        }
    }
=end
counter = ->{
    privateCounter = 0
    changeBy = ->(val){privateCounter += val}
    
    ->{changeBy[1]}
    }

myCounter = counter[]
myCounter[]
myCounter[]
myCounter[]
#myCounter["increment"][]
#myCounter["increment"][]
#myCounter["value"][]