 (defn marshal
   [em o as-map-key cache]
   ;;(prn "marshal" o (tag o) (rep o))
-  (if-let [h (handler o)]
-    (let [tag (tag h o)
-          rep (rep h o)]
+  (let [h (handler o)
+        tag (when h (tag h o))
+        rep (when h (rep h o))]
+    (if (and h tag)
       ;;(prn "marshal" tag rep)
       (case tag
         "_" (emit-nil em as-map-key cache)

        "'" (emit-quoted em rep cache)
        "array" (emit-array em rep as-map-key cache)
        "map" (emit-map em rep as-map-key cache)
        (emit-encoded em h tag o as-map-key cache)))
    (throw (ex-info "Not supported" {:o o :type (type o)}))))

(defn maybe-quoted
  [o]

 (reify Handler
   (tag [_ l] (if (seq? l) "list" "array"))
   (rep [_ l] (if (seq? l) (as-tag "array" l nil) l))
   (str-rep [_ _] nil))

 java.lang.Iterable
 (reify Handler
   (tag [_ _] "array")
   (rep [_ i] i)
   (str-rep [_ _] nil))

 AsTag
