Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: bc0a0b870a
Fetching contributors…

Cannot retrieve contributors at this time

16 lines (15 sloc) 0.485 kB
(ns tryclojure.views.eval
(:use [noir.core :only [defpage]]
[noir.response :only [json]]
[tryclojure.models.eval :only [eval-request]]))
(defpage "/eval.json" {:keys [expr jsonp]}
(update-in
(json
(let [{:keys [expr result error message] :as res} (eval-request expr)]
(if error
res
(let [[out res] result]
{:expr (pr-str expr)
:result (str out (pr-str res))}))))
[:body]
#(if jsonp (str jsonp "(" % ")") %)))
Jump to Line
Something went wrong with that request. Please try again.