How does banker’s method work?
I am reading Purely Functional Data Structures and I have trouble understanding the banker's method for persistent data structures.
tail' (_ : (!xs)) = xs, then:
tail (tail [1,2]) the unshared cost is 1 because you just create thunk.
tail' (tail' [1,2]) the unshared cost is 2 because you actually evaluate the expression.
Am I right?
The amortized cost of an operation is the unshared cost of the operation plus the number of debits discharged by the operation.
But how do you actually discharge debits? Author never mentions that…
Submitted July 17, 2017 at 04:51PM by Ford_O
via reddit http://ift.tt/2uqOntc