anchor.diff:  ;; TODO - CouchDB places restrictions on what sort of URLs are accepted, such as everything having
   ;;        to be downcase, and only certain characters being accepted. There is also special meaning
   ;;        behing the use of /, so a mechanism to escape it in certain situations would be good.
  -(defmessage db-request (db &key)
  +(defmessage db-request (db uri &key)
     (:documentation "Sends a CouchDB request to DB.")
  -  (:reply ((db =database=) &rest all-keys &key (uri ""))
  +  (:reply ((db =database=) uri &rest all-keys)
       (apply #'couch-request (server db) (strcat (name db) "/" uri) all-keys)))
   
   (defmacro handle-request ((result-var request) &body expected-responses)
  
positive.code: (defmessage get-document (db id)
    (:documentation "Returns an CouchDB document from DB as an alist.")
    (:reply ((db =database=) id)
      (handle-request (response (db-request db :uri id))
        (:ok response)
        (:not-found (error 'document-not-found :db db :id id)))))
  
  
negative.code: (defun create-db (name &key (prototype =database=) (server =json-server=))
    "Creates a new CouchDB database. Returns a database object that can be used to operate on it."
    (let ((db (create prototype 'server server 'name name)))
      (handle-request (response (db-request db "" :method :put))
        (:created db)
        (:internal-server-error (error "Illegal database name: ~A" name))
        (:precondition-failed (error 'db-already-exists :uri (db-namestring db))))))
  