4 comments

[ 3.5 ms ] story [ 17.7 ms ] thread
Isn't he looping many times in this example. In an imperative language I would loop through the records once, find savings accounts, get balance and add to total - all in one loop.
The point of the article was likely only this Thrush feature, and not the problem of implementing accounting systems.

For a small list like this I would use a fold function and accumulate up savings account amounts, all in one pass, all functional.

It doesn't need (seq accounts).