Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created August 28, 2011 18:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swannodette/1177009 to your computer and use it in GitHub Desktop.
Save swannodette/1177009 to your computer and use it in GitHub Desktop.
redblack.clj
;; 220ms
(let [t (object-array [:black
(object-array [:red
(object-array [:red nil nil nil]) nil nil]) nil nil])]
(dotimes [_ 10]
(time
(dotimes [_ 1e7]
(matchv ::objects [t]
[([:black [:red [:red _ _ _] _ _] _ _] |
[:black [:red _ _ [:red _ _ _]] _ _] |
[:black _ _ [:red [:red _ _ _] _ _]]])] :valid
:else :invalid)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment