summaryrefslogtreecommitdiff
path: root/clojure/collection-type.clj
diff options
context:
space:
mode:
Diffstat (limited to 'clojure/collection-type.clj')
-rw-r--r--clojure/collection-type.clj8
1 files changed, 8 insertions, 0 deletions
diff --git a/clojure/collection-type.clj b/clojure/collection-type.clj
new file mode 100644
index 0000000..2bce856
--- /dev/null
+++ b/clojure/collection-type.clj
@@ -0,0 +1,8 @@
+(let [typeof {(type '(1)) :list
+ (type []) :vector
+ (type {}) :map}]
+ (defn collection-type [col] (typeof (type col))))
+
+(println (collection-type '(1 2 3)))
+(println (collection-type [1 2 3]))
+(println (collection-type {1 2, 3 4}))