How do you make a binary search tree in Clojure?

前端 未结 3 2127
傲寒
傲寒 2021-02-08 10:04

In Scheme, I can use define-struct to make a binary search tree, but how do you do it in Clojure?

3条回答
  •  旧时难觅i
    2021-02-08 10:13

    I don't know Clojure, but I bet it's the same way you do it in Scheme without define-struct ... just cons together the left and right branches. To find something, recurse until you hit an atom.

    Seriously, though, structmaps sound like what you want. I found this page. Look for structmaps about half way down.

提交回复
热议问题