Friday, January 2, 2015

What is {} in Clojure?

In Clojure, {} is a persistent array-map.

You can check the type as follows:

(println (type {}))

Then you can get the result as follows:

clojure.lang.PersistentArrayMap

What is array-map?

array-map is a form to convert from an array to a map

using the elements in the array as a key, a value, a key, a value, and so on.

References:
https://clojuredocs.org/clojure.core/array-map
http://clojure.org/data_structures#Data Structures-ArrayMaps

No comments:

Post a Comment