(defn current-balance [accounts]
;; Recursively loop over all accounts,
(loop [balance 0
accounts accounts]
(if (first accounts)
(let [[account transactions] (first accounts)]
(println "Processing account" account) ;; <--- Added to inspect the loop
(recur (+ balance (sum-transactions transactions))
accounts))
balance)))
;;;; Re-running the code, the output shows this:
;; Processing account :savings
;; Processing account :savings
;; Processing account :savings
;; Processing account :savings
;; Processing account :savings
;; ...