Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 10
    Yes, Clojure vectors are implemented as trees—but it bears noting that they are hash array mapped tries, not your standard binary data Tree a = Leaf a | Branch a (Tree a) (Tree a)s. This reinforces your "simplicity" argument. Commented Sep 4, 2017 at 15:38
  • 1
    FWIW Clojure's persistent vectors are implemented as (as @wchargin points out somewhat complex) trees for fast (logarithmic with a large base) access and update of arbitrary elements, not really for parallel operation per se (the immutable part takes care of that to some degree). Other FP languages make the same choice (sometimes with different kinds of trees) when they want both of those (e.g. Haskell's Sequence or Scala's Vector), but don't use trees when they only need read since they can achieve that in true constant time (e.g. Haskell's Vector or F# via .Net's ImmutableArray) Commented Sep 4, 2017 at 18:13
  • 1
    E.g. pmapping over a vector in Clojure still accesses each element sequentially; the tree structure of the vector is generally hidden from the end user. Commented Sep 4, 2017 at 18:20