From a809058e10ceeb9688b2937a6bf98563b3a3d528 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Sun, 5 Dec 2021 20:57:51 +0800 Subject: [PATCH] [qif-guess-map] simplify extract-all-account-info --- .../import-export/qif-imp/qif-guess-map.scm | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/gnucash/import-export/qif-imp/qif-guess-map.scm b/gnucash/import-export/qif-imp/qif-guess-map.scm index 94705561e2..75e7a8304b 100644 --- a/gnucash/import-export/qif-imp/qif-guess-map.scm +++ b/gnucash/import-export/qif-imp/qif-guess-map.scm @@ -102,27 +102,10 @@ ;; GnuCash account. Each member of the list is itself a list with ;; the form: (shortname fullname Account*) (define (extract-all-account-info an-account root-name) - (if (null? an-account) - '() - (let ((children-list (gnc-account-get-children-sorted an-account)) - (names '())) - - ;; Recursively walk the account tree. - (for-each - (lambda (child-acct) - (let* ((name (xaccAccountGetName child-acct)) - (fullname - (if (string? root-name) - (string-append root-name - (gnc-get-account-separator-string) - name) - name))) - (set! names - (append (cons (list name fullname child-acct) - (extract-all-account-info child-acct fullname)) - names)))) - children-list) - names))) + (map + (lambda (acct) + (list (xaccAccountGetName acct) (gnc-account-get-full-name acct) acct)) + (gnc-account-get-descendants-sorted an-account))) (define (safe-read) (false-if-exception