/dev/user.clj

https://github.com/vlaaad/reveal · Clojure · 56 lines · 53 code · 3 blank · 0 comment · 0 complexity · 33e9172906e8bad8bb0f1df44abb5fbc MD5 · raw file

  1. (ns user
  2. (:require [clojure.spec.test.alpha :as stest])
  3. (:import [clojure.lang PersistentQueue]
  4. [java.util UUID HashSet HashMap ArrayList Date LinkedList]
  5. [java.sql Timestamp]
  6. [java.time Instant LocalTime LocalDateTime ZoneOffset]))
  7. (stest/instrument)
  8. (def interesting-values
  9. {:numbers {:integer (int 1)
  10. :long (long 2)
  11. :double (double 1.2)
  12. :float (float 3.14)
  13. :big-integer (biginteger 3)
  14. :big-decimal (bigdec 4)
  15. :ratio 3/4
  16. :short (short 5)
  17. :byte (byte 6)
  18. :big-int (bigint 7)}
  19. :scalars {:boolean true
  20. :keyword :keyword
  21. :q-keyword :qualified/keyword
  22. :symbol 'symbol}
  23. :strings {:string "string"
  24. :character \c
  25. :re #"(\s)+"}
  26. :queue (conj (PersistentQueue/EMPTY) 1 2 3)
  27. :bytes (.getBytes "bytes")
  28. :uuid (UUID/randomUUID)
  29. :colls {:java {:set (doto (HashSet.) (.add 1) (.add 2) (.add 3))
  30. :map (doto (HashMap.) (.put :foo "bar"))
  31. :array-list (doto (ArrayList.) (.add 1) (.add 2) (.add 3))
  32. :linked-list (doto (LinkedList.) (.add '/) (.add 1) (.add :a))}
  33. :clojure {:set #{:a :b :c}
  34. :map {:foo "bar"}
  35. :list '(+ 1 2 3)
  36. :syntax-quoted `(+ 1 2 3)
  37. :range (range 5 10)
  38. :vec [1 2 3]}}
  39. :refs {:var #'inc
  40. :future (future 10)
  41. :delay (delay 20)
  42. :promise (doto (promise) (deliver 1))
  43. :atom (atom :atom)
  44. :agent (agent "agent")
  45. :ref (ref 1)}
  46. :dates {:date (Date. 0)
  47. :timestamp (Timestamp. 0)
  48. :instant (Instant/ofEpochMilli 0)
  49. :local-time (LocalTime/ofNanoOfDay 0)
  50. :local-date-time (LocalDateTime/ofEpochSecond 0 0 ZoneOffset/UTC)}})
  51. (comment
  52. (->> (range 10000)
  53. (map #(hash-map :index % :string (str %)))))