 (ns exemplar
   (:require [transit.read :as r]
             [transit.write :as w]
-            [clojure.java.io :as io]))
+            [clojure.java.io :as io])
+  (:import [java.net URI]))
 
 ;; Generate a set of increasingly complex transit files.
 ;; Output checked into the transit repo under simple-examples.
 
 (import [java.io File FileOutputStream ByteArrayInputStream ByteArrayOutputStream OutputStreamWriter])
 
-(defn range-centered-on 
+(defn range-centered-on
   ([n] (range-centered-on n 5))
   ([n m] (vec (range (- n m) (+ n m 1)))))
-  
+
 (defn vmap [f s]
   (vec (map f s)))
 

  (write-exemplar "map_string_keys" "A map with string keys" {"first" 1, "second" 2, "third" 3})

  (write-exemplar "map_numeric_keys" "A map with numeric keys" {1 "one", 2 "two"})
 
  (write-exemplar "map_vector_keys" "A map with vector keys" {[1 1] "one", [2 2] "two"})
  
  (write-exemplar "map_10_items" "10 item map"  (map-of-size 10))
  
  (doseq [i [10 90 91 92 93 94 95]]
    (write-exemplar 
      (str "map_" i "_nested")
      (str "Map of two nested " i " item maps")
      {:f (map-of-size i) :s (map-of-size i)}))
  
  (write-exemplar 
    "maps_two_char_sym_keys"
    "Vector of maps with identical two char symbol keys"
    [{:aa 1 :bb 2} {:aa 3 :bb 4} {:aa 5 :bb 6}])
  
  (write-exemplar 
    "maps_three_char_sym_keys"
    "Vector of maps with identical three char symbol keys"
    [{:aaa 1 :bbb 2} {:aaa 3 :bbb 4} {:aaa 5 :bbb 6}])
  
  (write-exemplar 
    "maps_four_char_sym_keys"
    "Vector of maps with identical four char symbol keys"
    [{:aaaa 1 :bbbb 2} {:aaaa 3 :bbbb 4} {:aaaa 5 :bbbb 6}])
  
  (write-exemplar 
    "maps_two_char_string_keys"
    "Vector of maps with identical two char string keys"
    [{"aa" 1 "bb" 2} {"aa" 3 "bb" 4} {"aa" 5 "bb" 6}])
  
  (write-exemplar 
    "maps_three_char_string_keys"
    "Vector of maps with identical three char string keys"
    [{"aaa" 1 "bbb" 2} {"aaa" 3 "bbb" 4} {"aaa" 5 "bbb" 6}])
  
  (write-exemplar 
    "maps_four_char_string_keys"
    "Vector of maps with identical four char string keys"
    [{"aaaa" 1 "bbbb" 2} {"aaaa" 3 "bbbb" 4} {"aaaa" 5 "bbbb" 6}])

    (apply
      sorted-map
      (interleave (map #(keyword (format "key%04d" %)) nums) nums))))

(defn write-description [file-name description vals]
  (println "##" description)
  (println "* Files:" (str file-name ".edn") (str file-name ".json") (str file-name ".mp"))
