aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-04-23 22:47:33 +0200
committerHugo Hörnquist <hugo@hornquist.se>2019-04-23 22:48:17 +0200
commite3ea01b57e93c6c686e70f07a0560250c453628b (patch)
treed2176d279325245912e1403ae3399385a16bae85
parentReplace text-flow function. (diff)
downloadcalp-e3ea01b57e93c6c686e70f07a0560250c453628b.tar.gz
calp-e3ea01b57e93c6c686e70f07a0560250c453628b.tar.xz
Change how branch length is calculated.
-rw-r--r--module/util/tree.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/module/util/tree.scm b/module/util/tree.scm
index 103888cc..8d3e7805 100644
--- a/module/util/tree.scm
+++ b/module/util/tree.scm
@@ -27,8 +27,11 @@
;; Length includes current node, so the length of a leaf is 1.
(define (length-of-longst-branch tree)
(if (null? tree)
- 0 (1+ (max (length-of-longst-branch (left-subtree tree))
- (length-of-longst-branch (right-subtree tree))))))
+ ;; Having the @var{1+} outside the @var{max} also works,
+ ;; but leads to events overlapping many other to be thinner.
+ ;; Having it inside makes all events as evenly wide as possible.
+ 0 (max (1+ (length-of-longst-branch (left-subtree tree)))
+ (length-of-longst-branch (right-subtree tree)))))
(define (tree-map proc tree)
(if (null? tree) '()