     (assert (= true (compare-and-set! a 1 7)))
     (assert (nil? (meta a)))
     (assert (nil? (get-validator a))))
+  (let [a (atom 0)]
+    (assert (= 1 (swap! a + 1)))
+    (assert (= 4 (swap! a + 1 2)))
+    (assert (= 10 (swap! a + 1 2 3)))
+    (assert (= 20 (swap! a + 1 2 3 4))))
   (let [a (atom [1] :validator coll? :meta {:a 1})]
     (assert (= coll? (get-validator a)))
     (assert (= {:a 1} (meta a)))

  :ok
  )

#_(goog.global/print (assoc {} :a 1))
  the value that was swapped in."
  ([a f]
     (reset! a (f (.state a))))
  ([a f x]
     (reset! a (f (.state a) x)))
  ([a f x y]
     (reset! a (f (.state a) x y)))  
  ([a f x y z]
     (reset! a (f (.state a) x y z)))
  ([a f x y z & more]
     (reset! a (apply f (.state a) x y z more))))

(defn compare-and-set!
  "Atomically sets the value of atom to newval if and only if the
