diff --git a/gnucash/report/report-system/commodity-utilities.scm b/gnucash/report/report-system/commodity-utilities.scm index c6e1f29bb0..1463ef0816 100644 --- a/gnucash/report/report-system/commodity-utilities.scm +++ b/gnucash/report/report-system/commodity-utilities.scm @@ -618,10 +618,9 @@ construct with gnc:make-gnc-monetary and gnc:monetary->string instead.") ;; total balances from get-exchange-totals are divided by each ;; other. (map - (lambda (e) - (list (car e) - (abs (/ ((cdadr e) 'total #f) - ((caadr e) 'total #f))))) + (match-lambda + ((comm (domestic . foreign)) + (list comm (abs (/ (foreign 'total #f) (domestic 'total #f)))))) (gnc:get-exchange-totals report-commodity end-date))) (define (gnc:make-exchange-cost-alist report-commodity end-date) @@ -629,12 +628,10 @@ construct with gnc:make-gnc-monetary and gnc:monetary->string instead.") ;; total balances from get-exchange-totals are divided by each ;; other. (map - (lambda (e) - (list (car e) - (if (zero? ((caadr e) 'total #f)) - 0 - (abs (/ ((cdadr e) 'total #f) - ((caadr e) 'total #f)))))) + (match-lambda + ((comm (domestic . foreign)) + (let ((denom (domestic 'total #f))) + (list comm (if (zero? denom) 0 (abs (/ (foreign 'total #f) denom))))))) (gnc:get-exchange-cost-totals report-commodity end-date))) @@ -973,7 +970,7 @@ construct with gnc:make-gnc-monetary and gnc:monetary->string instead.") (define (gnc:uniform-commodity? amt report-commodity) ;; function to see if the commodity-collector amt ;; contains any foreign commodities - (let ((list-of-commodities (amt 'format (lambda (comm amt) comm) #f))) - (or (null? list-of-commodities) - (and (null? (cdr list-of-commodities)) - (gnc-commodity-equiv report-commodity (car list-of-commodities)))))) + (match (amt 'format (lambda (comm amt) comm) #f) + (() #t) + ((comm) (gnc-commodity-equiv report-commodity comm)) + (_ #f)))