Closed soegaard closed 1 year ago
That fix doesn't work for adjustable splay trees. Adjustable splay trees store each node's key (which must be numeric) as the difference from its parent's key.
(require data/splay-tree)
(define s (make-adjustable-splay-tree))
(splay-tree-set! s 1 'a)
(splay-tree-set! s 2 'b)
(splay-tree-set! s 3 'c)
(splay-tree->list s)
;; => '((1 . a) (2 . b) (3 . c))
I think the right fix is to change (+ key k*)
to (if adjust? (+ key k*) key)
, but I haven't tested it.
Yes, that works for both. I'll make a new PR.
The current splay-tree->list doesn't handle non-numeric keys due to the expression
(+ key k*)
. This PR simply removes thek*
variable.A test case that shows the bug: