Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create an empty hash-map in clojure

Tags:

clojure

It gives me a ArrayMap as I code

(class (hash-map))

But it comes out a HashMap when I code:

(class (hash-map "" ""))

Question is "How can I create an empty hash-map"?

like image 666
Fionser Avatar asked Oct 13 '25 00:10

Fionser


1 Answers

Another possibility is to use pre-defined EMPTY field:

user=> (clojure.lang.PersistentHashMap/EMPTY)
{}

In my opinion it is better shows your intent.

like image 137
om-nom-nom Avatar answered Oct 16 '25 07:10

om-nom-nom