Algebraic Data Type
:dependencies [[zjhmale/adt "0.1.0"]]
(require [adt.sweet :refer :all])
(defadt ::tree
Empty-tree
(Leaf value)
(Node left-tree value right-tree))
(defn depth
[t]
(match t
Empty-tree 0
(Leaf _) 1
(Node l v r) (inc (max (depth l) (depth r)))))
Copyright © 2010 Rich Hickey and the various contributors
Distributed under the Eclipse Public License, the same as Clojure.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close