Skip to content

Instantly share code, notes, and snippets.

@killerswan
Forked from swannodette/gist:1257981
Created October 2, 2011 21:40
Show Gist options
  • Save killerswan/1258000 to your computer and use it in GitHub Desktop.
Save killerswan/1258000 to your computer and use it in GitHub Desktop.
redblacknew.cljs
(defn balance [node]
(match [node]
[( [: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]]]
)]
[:red [:black a x b] y [:black c z d]]
:else
node))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment