Single

typesince v1.9.562Edit
(Single. val)

Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(deftype Single [^:mutable val]
  Object
  (add [this o]
    (if (identical? val NONE)
      (do
        (set! val o)
        this)
      (Many. #js [val o])))
  (remove [this]
    (if (identical? val NONE)
      (throw (js/Error. (str "Removing object from empty buffer")))
      (let [ret val]
        (set! val NONE)
        ret)))
  (isEmpty [this]
    (identical? val NONE))
  (toString [this]
    (str "Single: " val)))