Add bank account accessors.

This commit is contained in:
Dominik Pantůček 2023-03-30 15:43:37 +02:00
parent 51747cfe84
commit 29aa9d9eba

View file

@ -29,6 +29,9 @@
bank-account bank-account
( (
make-bank-account make-bank-account
bank-account-transactions
bank-account-number
bank-account-bank
bank-account-insert bank-account-insert
make-bank-transaction make-bank-transaction
@ -49,6 +52,11 @@
(car maybe-transactions)))) (car maybe-transactions))))
(list transactions number bank))) (list transactions number bank)))
;; Trivial accessors
(define bank-account-transactions car)
(define bank-account-number cadr)
(define bank-account-bank caddr)
;; Prepends given transaction to given bank account. It expects the ;; Prepends given transaction to given bank account. It expects the
;; transactions list to be the first element of the bank account ;; transactions list to be the first element of the bank account
;; list. ;; list.