You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Being able to match directly on deftype and defrecords seems
useful. We have a lot more information than we do in the case of
primitive Java arrays - we have type information and via reflection we
can get the field names, deftype and defrecord both have
positional constructors.
(defnbalance [node]
(match [node]
[(:or (Black. (Red. (Red. a x b) y c) z d)
(Black. (Red. a x (Red. b y c)) z d)
(Black. a x (Red. (Red. b y c) z d))
(Black. a x (Red. b y (Red. c z d))))] :balance:else:balanced))