[report-utilities] compact code, use (ice-9 match)

This commit is contained in:
Christopher Lam 2020-02-05 15:35:01 +08:00
parent dafff68914
commit ad094f4345

View File

@ -423,11 +423,10 @@ construct gnc:make-gnc-monetary and use gnc:monetary->string instead.")
;; usage: (gnc:monetaries-add monetary1 monetary2 ...) ;; usage: (gnc:monetaries-add monetary1 monetary2 ...)
;; output: a monetary object ;; output: a monetary object
(define (gnc:monetary+ . monetaries) (define (gnc:monetary+ . monetaries)
(let* ((coll (apply gnc:monetaries-add monetaries)) (let ((coll (apply gnc:monetaries-add monetaries)))
(list-of-monetaries (coll 'format gnc:make-gnc-monetary #f))) (match (coll 'format gnc:make-gnc-monetary #f)
(if (null? (cdr list-of-monetaries)) ((mon) mon)
(car list-of-monetaries) (_ (throw "gnc:monetary+ expects 1 currency " (gnc:strify monetaries))))))
(throw "gnc:monetary+ expects 1 currency " (gnc:strify monetaries)))))
;; get the account balance at the specified date. if include-children? ;; get the account balance at the specified date. if include-children?
;; is true, the balances of all children (not just direct children) ;; is true, the balances of all children (not just direct children)