 
 (defn- lint-ispec [ispec]
   (cond
-    (keyword? ispec) :ok
+    (attr?   ispec) :ok
     (vector? ispec)
       (doseq [ispec-comp ispec]
         (cond
-          (keyword? ispec-comp) :ok
+          (attr?   ispec-comp) :ok
           (vector? ispec-comp)
             (lint #(= 2 (count %)) ispec-comp "index spec component vector must have 2 elements")
             (lint-attr (first ispec-comp))
             (lint-dir  (second ispec-comp)))
           :else
-            (fail "index spec component must be a keyword or vector" ispec-comp))
+            (fail "index spec component must be a string or vector" ispec-comp))
     :else
-      (fail "index spec must be a keyword or vector" ispec)))
+      (fail "index spec must be a string or vector" ispec)))
 
 (defn lint-num-args [n q]
   (if (integer? n)

         (let [[_ & sub-wheres] where]
           (lint #(not (empty? %)) sub-wheres "no sub clauses given")
           (domap lint-where sub-wheres))
       (= :in op)
         (do
           (lint #(= 3 (count %)) where ":in clause has 2 arguments")
           (let [[_ attr vals] where]
             (lint-attr attr)
             (lint vector? vals "vals for :in must be in a vector")
             (domap lint-val vals)))
       :else
         (fail "unrecognized where operation" op))))

(defn- lint-only [only]
  (cond
    (keyword? only) :ok
    (vector?  only) (domap lint-attr only)
    :else           (fail "unrecognized :only value" only)))

(defn- lint-find-opts [opts allow-only]
  (when-not (nil? opts)
    (lint map? opts "options not a map")
    (doseq [[opt-name opt-val] opts]
      (condp = opt-name
        :limit  (lint-pos-int opt-val "limit")
        :offset (lint-pos-int opt-val "offset")
        :order  (lint-order opt-val)
        :where  (lint-where opt-val)
        :only
          (if-not allow-only
            (fail "only option not applicable for this query" opt-val)
            (lint-only opt-val))


(defn- lint-order [order]
  (lint vector? order "order not a vector")
  (if (attr? (first order))
    (lint-order-comp order)
    (domap lint-order-comp order)))

(def- sing-ops #{"=" "!=" "<" "<=" ">" ">="})
(def- doub-ops #{"><" ">=<" "><=" ">=<="})
(def- conj-ops #{"and" "or"})

(defn- lint-where [where]
  (lint vector? where "where not a vector")
