Why does eval on a lambda expression fail? but evaluating a defn works? Here's the code example:
(defn async-eval [s-expression] (let [c (chan) cljs-state (cljs.js/empty-state)] (cljs.js/eval cljs-state s-expression {:eval cljs.js/js-eval} (fn [a-map] (go (let [value (:value a-map)] (prn (keys a-map)) (prn "value= " value) (>! c value))))) c)) ;;this works (go (let [f (<! (async-eval '(defn add [x] (+ x 1))))] (prn (f 2)) )) ;;this doesn't work (go (let [f (<! (async-eval '(fn [x] (+ x 1))))] (prn (f 2)) )) -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.