isaacabraham / get-programming-fsharp

Companion code repository for https://www.manning.com/books/get-programming-with-f-sharp
124 stars 57 forks source link

Lesson 14 is too big a step #11

Open MichielNass opened 3 years ago

MichielNass commented 3 years ago

Hi, just wanted to let you know that the book was good until lesson 14. I was happy with my progress, now I am considering a book burning, lesson 14 is way too big a leap!

I had to cheat, aka going here and coping code to get it to work and now I do not understand it...

The problem is this part: /// Runs some account operation such as withdraw or deposit with auditing. let auditAs operationName audit operation amount account = audit account (sprintf "%O: Performing a %s operation for £%M..." DateTime.UtcNow operationName amount) let updatedAccount = operation amount account

let accountIsUnchanged = (updatedAccount = account)

if accountIsUnchanged then audit account (sprintf "%O: Transaction rejected!" DateTime.UtcNow) 
else audit account (sprintf "%O: Transaction accepted! Balance is now £%M." DateTime.UtcNow updatedAccount.Balance)

updatedAccount
MichielNass commented 3 years ago

You never explained the "audit" in the let auditAs

AlbertoLeon commented 3 years ago

You never explained the "audit" in the let auditAs

Page 166, first paragraph "audit — the audit function you want to call (for example, the console audit function)"