Sha256: 5f82988a07c5df0280d1b2b5ff2d1b7d01e11aab1a1a7a79afd6936e9c4fba53
Contents?: true
Size: 690 Bytes
Versions: 301
Compression:
Stored size: 690 Bytes
Contents
module BankAccount open System type BankAccount() = member val Lock = new Object() member val Balance: float option = None with get,set let mkBankAccount() = BankAccount() let openAccount (account: BankAccount) = lock account.Lock (fun () -> account.Balance <- Some 0.0 account ) let closeAccount (account: BankAccount) = lock account.Lock (fun () -> account.Balance <- None account ) let getBalance (account: BankAccount) = account.Balance let updateBalance change (account: BankAccount) = lock account.Lock (fun () -> account.Balance <- Option.map ((+) change) account.Balance account )
Version data entries
301 entries across 301 versions & 1 rubygems
Version | Path |
---|---|
trackler-2.0.5.10 | tracks/fsharp/exercises/bank-account/Example.fs |