mark
mark

Reputation: 873

why aren't clojure strings of type clojure.string?

Just curious on why a string in Clojure isn't of type clojure.string, and instead is java.lang.String. It seems a bit odd that I need to require clojure.string to access the native Clojure string functions?

Upvotes: 3

Views: 146

Answers (1)

ponzao
ponzao

Reputation: 20934

Because java.lang.String is immutable and doesn't break interoperability with Java. The functions in clojure.string can be mostly considered as a convenience layer on top of already existing functionality in the JDK and/or clojure.core.

Upvotes: 6

Related Questions