mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[html-utilities] tighten code
using list-ref and length repeatedly is usually less efficient than testing against null?
This commit is contained in:
parent
a33302f1e6
commit
3b187a1282
@ -122,13 +122,11 @@
|
|||||||
"#F012BE" "#3D9970" "#39CCCC" "#f39c12"
|
"#F012BE" "#3D9970" "#39CCCC" "#f39c12"
|
||||||
"#e74c3c" "#e67e22" "#9b59b6" "#8e44ad"
|
"#e74c3c" "#e67e22" "#9b59b6" "#8e44ad"
|
||||||
"#16a085" "#d35400"))
|
"#16a085" "#d35400"))
|
||||||
(define (assign-colors i)
|
(let lp ((i 0) (result '()) (colors base-colors))
|
||||||
(if (<= num-colors i)
|
(cond
|
||||||
'()
|
((>= num-colors i) (reverse result))
|
||||||
(cons (list-ref base-colors
|
((null? colors) (lp (1+ i) (cons (car colors) result) base-colors))
|
||||||
(modulo i (length base-colors)))
|
(else (lp (1+ i) (cons (car colors) result) (cdr colors))))))
|
||||||
(assign-colors (+ i 1)))))
|
|
||||||
(assign-colors 0))
|
|
||||||
|
|
||||||
;; Appends a horizontal ruler to a html-table with the specified
|
;; Appends a horizontal ruler to a html-table with the specified
|
||||||
;; colspan at, optionally, the specified column.
|
;; colspan at, optionally, the specified column.
|
||||||
@ -183,9 +181,6 @@
|
|||||||
table tree-depth
|
table tree-depth
|
||||||
current-depth my-name my-balance
|
current-depth my-name my-balance
|
||||||
reverse-balance? row-style boldface? group-header-line?)
|
reverse-balance? row-style boldface? group-header-line?)
|
||||||
;; just a stupid little helper
|
|
||||||
(define (identity a)
|
|
||||||
a)
|
|
||||||
(gnc:html-table-append-row/markup!
|
(gnc:html-table-append-row/markup!
|
||||||
table
|
table
|
||||||
row-style
|
row-style
|
||||||
|
Loading…
Reference in New Issue
Block a user