Algebraic data types: Difference between revisions
Content added Content deleted
(update as per kpreid's suggestions) |
|||
Line 16:
(defstruct (red-black-tree (:constructor tree (color left val right)))
color left val right)
(defcomponent tree (operator macro-mixin))
(defexpand tree (color left val right)
Line 24:
red-black-tree-right ,right))
(pushnew 'tree *used-components*)
(defun balance (color left val right)
(toad-ecase (color left val right)
(tree color a x b))))
(defun %insert (x s)
(toad-
(nil
((tree color a y b
(cond ((< x y)
(balance
(balance color a y (%insert x
(t s)))))
(defun insert (x s)
(toad-
((tree t a y b)
=={{Header|E}}==
|