Hacker News new | ask | show | jobs
by ubercow 3313 days ago
Clojure's "killer feature" for me is the by-default persistent data structures.

Are there any other functional languages out there with similar features? Lisp or otherwise.

4 comments

Erlang/Elixir also is immutable & persistent by default.
It is immutable and persistent, but not with the same performance characteristics. It lacks Bagwell's data structures that allow structural sharing. Take a 10 million item list in elixir and 'change' (return a new) the 5 millionth element. Time how long it takes. Do the same with clojure. Compare.
That was true a few years ago, but not anymore: https://medium.com/@jlouis666/breaking-erlang-maps-1-31952b8...

(You would have to use a map though, the native lists are still plain old lists)

In Haskell, data structures are immutable, persistent, and use structural sharing by default.
Elixir has that, and you can't even drop into Java/JVM mode to violate it! ;)

Haskell as well, I believe.

Scala has a collections library that heavily emphasizes immutable/persistent data sructures. You aren't forces to use them but it is idiomatic Scala to be "pure"/non mutating.