   IAssociative
   (-assoc [coll k v]
     (if (goog.isString k)
-      (let [new-strobj (goog.cloneObject strobj) ; should use goog.object.clone
+      (let [new-strobj (goog.object.clone strobj)
             overwrite? (.hasOwnProperty new-strobj k)]
         (aset new-strobj k v)
         (if overwrite?

      (if (not (.hasOwnProperty strobj k))
        coll ; key not found, return coll unchanged
        (let [new-keys (array-clone keys)
              new-strobj (goog.cloneObject strobj)
              new-count (dec (.length keys))]
          (.splice new-keys (scan-array 1 k new-keys) 1)
          (js-delete new-strobj k)


(ns cljs.core)
(goog.require "goog.string.StringBuffer")
(goog.require "goog.object")

(defprotocol ICounted
  (-count [coll] "constant time count"))
