Guest User

Untitled

a guest
Jul 22nd, 2019
50
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (fn [ds]
  2. (let [is-map? (fn [ds] (:my-secret-key (conj ds [:my-secret-key true])))
  3. is-list? (fn [l] (= [:b :a] (take 2 (-> l (conj :a) (conj :b)))))
  4. is-vector? (fn [v] (= [:a :b] (take-last 2 (-> v (conj :a) (conj :b)))))
  5. is-set? (fn [s]
  6. (= 1 (-> (group-by identity (-> s (conj :test) (conj :test)))
  7. (get :test)
  8. (count))))]
  9. (cond (is-map? ds)
  10. :map
  11. (is-set? ds)
  12. :set
  13. (is-list? ds)
  14. :list
  15. (is-vector? ds)
  16. :vector
  17. :default
  18. :unknown)))
RAW Paste Data