          (every? branch! (:branches x))))
 
 (defchecked step! [x]
-  (check (id! (:id x))
-         (order! (:order x)))
+  (check (id! (:id x)))
   (case (:type x)
     :call (call! x)
     :constant (constant! x)


(defchecked id! [x]
  (check (string? x)))

(defchecked order! [x]
  (check (number? x)))

(defchecked js! [x]
  (check (string? x)))

         (id! (:id x))
         (sequential? (:args x))
         (every? id! (:args x))
         (sequential? (:steps x))
         (every? step! (:steps x))))

(defchecked notebook! [x]
  (check (= :notebook (:type x))
         (id! (:id x))
         (sequential? (:pages x))
         (every? page! (:pages x))))

;; examples

(def example-a
  {:type :notebook
   :id "example_a"
   :pages [{:type :page
            :id "root"
            :args ["a" "b" "c"]
            :steps [{:id "b_squared"
                     :type :call
                     :ref {:type :ref/js
                           :js "cljs.core._STAR_"}
                     :args [{:type :ref/id :id "b"} {:type :ref/id :id "b"}]}
                    {:id "four"
                     :type :constant
                     :data 4}
                    {:id "four_a_c"
                     :type :call
                     :ref {:type :ref/js
                           :js "cljs.core._STAR_"}
                     :args [{:type :ref/id :id "four"} {:type :ref/id :id "a"} {:type :ref/id :id "c"}]}
                    {:id "result"
                     :type :call
                     :ref {:type :ref/js
                           :js "cljs.core._"}
                     :args [{:type :ref/id :id "b_squared"} {:type :ref/id :id "four_a_c"}]}]}]})

(notebook! example-a)

(def example-b
  {:type :notebook
   :id "example_b"
   :pages [{:type :page
            :id "root"
            :args ["x"]
            :steps [{:id "result"
                     :type :match
                     :arg {:type :ref/id :id "x"}
                     :branches [{:type :match/branch
                                 :pattern {"a" {:type :match/bind :id "a" :pattern {:type :ref/js :js "cljs.core.number_QMARK_"}}
                                           "b" {:type :match/bind :id "b" :pattern {:type :ref/js :js "cljs.core.number_QMARK_"}}}
                                 :action {:type :call
                                          :ref {:type :ref/js :js "cljs.core._"}
                                          :args [{:type :ref/id :id "a"} {:type :ref/id :id "b"}]}}
                                {:type :match/branch
                                 :pattern [{:type :match/bind :id "y" :pattern {:type :match/any}} "foo"]
                                 :action {:type :constant
                                          :data {:type :ref/id
                                                 :id "y"}}}]}]}]})

(notebook! example-b)
