mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[report-utilities] rewrite list-set-safe! using named let
This avoids some set! calls
This commit is contained in:
parent
7a63fab04a
commit
4f90663c9a
@ -24,17 +24,15 @@
|
||||
(list-ref list elt)))
|
||||
|
||||
(define (list-set-safe! l elt val)
|
||||
(if (and (list? l) (> (length l) elt))
|
||||
(unless (list? l)
|
||||
(set! l '()))
|
||||
(if (> (length l) elt)
|
||||
(list-set! l elt val)
|
||||
(let ((filler (list val)))
|
||||
(if (not (list? l))
|
||||
(set! l '()))
|
||||
(let loop ((i (length l)))
|
||||
(if (< i elt)
|
||||
(begin
|
||||
(set! filler (cons #f filler))
|
||||
(loop (+ 1 i)))))
|
||||
(set! l (append! l filler))))
|
||||
(let loop ((filler (list val))
|
||||
(i (length l)))
|
||||
(if (< i elt)
|
||||
(loop (cons #f filler) (1+ i))
|
||||
(set! l (append! l filler)))))
|
||||
l)
|
||||
|
||||
;; pair is a list of one gnc:commodity and one gnc:numeric
|
||||
|
Loading…
Reference in New Issue
Block a user