      (println "Hello!")))
 
 (macroexpand
-  '(def-tuple-rule my-regular-rule
+  '(defrule my-regular-rule
      "Docstring!!"
      [:todo/title [[e a v]] (= ?e e)]
      [:exists [:todo/done]]

;       ;; Add the environment, if given.
;       (not (empty? env)) (assoc :env matching-env)))))
(defn is-binding? [x]
  ;(println "Is a binding?" x)
  ;TODO. Long cannot be cast to Named
  (= (first (name x)) \?))

(defn rewrite-lhs [forms]
  (println "Forms" forms)
  (mapv (fn main-one [form]
         ;(println "Form" form)
         ;(println "Type" (type form))
         (println "is op" (dsl/ops (first form)))
         (if (dsl/ops (first form))
           form
           (let [bindings (into {}
                            (filter
                              (fn [[k v]]
                                (and (not= \_ v)
                                     (identity v)
                                     (is-binding? v)))
                              ;(juxt (comp identity second)
                              ;      (partial (not= \_)) second
                              ;      (comp is-binding? second)))
                              {:e (first form)
                               :a (second form)
                               :v (last form)}))
                 attribute (if (keyword? (second form)) (second form) :all)]
             (prn "Bindigs are" bindings)
             ;(println "attribute is" attribute)
            (vector
              attribute (vector ['e 'a 'v])
              (map (fn last-one [[k v]]
                       (println "k v bindings" k v)
                       (list '= v (symbol (name k)))) bindings)))))

    forms))
#?(:clj
   (defmacro def-tuple-rule
     "Defines a rule and stores it in the given var. For instance, a simple rule would look like this:

(ns todomvc.tuple-rule
    (:require [clara.rules :refer [defrule]]
              [clara.rules.compiler :as com]
              [clara.rules.dsl :as dsl]))


