Skip to content

Instantly share code, notes, and snippets.

@dwhitney
Created July 6, 2011 14:40
Show Gist options
  • Select an option

  • Save dwhitney/1067383 to your computer and use it in GitHub Desktop.

Select an option

Save dwhitney/1067383 to your computer and use it in GitHub Desktop.
val shouldApplyTransferFees: Boolean = atomic{ implicit t =>
var accounts = accountsRef()
val (from, to) = (accounts(fromNo), accounts(toNo))
if(from.balance > amount){
accounts = accounts + (to.accountNo -> to.credit(amount))
accounts = accounts + (from.accountNo -> from.debit(amount))
accountsRef() = accounts
true
}else false
}
if(shouldApplyTransferFees) applyTransferFees()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment