                         ]))
    :refer-clojure false
    ;; using 60000 for development: for production, use much smaller value.
-   :timeout 10000
+   :timeout 60000
+;   :timeout 15000
    :namespace 'babel.italiano.workbook))
 
 

(defn expr [id]
  (reader/id2expression (Integer. id)))

;; this def is needed to avoid initialization errors when evaluating within the workbook
;; e.g.: evaluating things like:
;;(generate {:synsem {:subcat '()
;;                                          :infl :imperfect
;;                                          :sem {:subj {:pred :I} :pred :be}}}
;;                                fr/small)

(def rules (:grammar-map medium))

(defn analyze
  ([surface-form]
   (analyze surface-form (:lexicon medium)))
  ([surface-form lexicon]
   (morph/analyze surface-form lexicon)))

(defn over
  ([arg1]
   (over/over (vals (:grammar-map medium)) (analyze arg1 medium)))
  ([grammar arg1]
   (over/over grammar (analyze arg1)))
  ([grammar arg1 arg2]
   (cond (string? arg1)
         (over grammar (analyze arg1)
               arg2)

         (string? arg2)
         (over grammar arg1 (analyze arg2))

         true
         (over/over grammar arg1 arg2))))

(def workbook-sandbox-it
  (sandbox

  (let [search-query (get (get request :query-params) "search")]
    (html
     [:div#workbook-ui {:class "quiz-elem"}
      [:h2 "Italiano Workbook"]

      [:div.hints
       [:h3 "Try:"]
       [:div "(expr X)"]
       [:div "(parse 'I speak')"]

       ]

