clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
denik 2021-01-03T19:54:31.058400Z

Is there a way to inline the result of a clojure expression in clojurescript? for example:

(into [:div] (map (fn [db-value] [:div db-value])) (clj-inline (db-get :foo)))
the result of the into should be the same in CLJ and CLJS

dazld 2021-01-03T22:31:00.062Z

Possibly a silly question, but why doesn’t

(-> (js/Promise.resolve {:foo :bar})
    (.then :foo)
    (.then prn))
..output :bar ?

dazld 2021-01-04T08:22:48.070700Z

Thanks!

dazld 2021-01-03T22:32:18.062100Z

(.then #(:foo %)) works fine, but isn’t this equivalent?

lilactown 2021-01-03T23:00:09.063100Z

.then expects a JS function, but you are passing a keyword

👍 1
lilactown 2021-01-03T23:02:20.065800Z

Keywords implement the IFn protocol, which make them callable when used in a ClojureScript context, but passing them as values to JS constructs like .then on promises, or .map on arrays, the JS constructs don’t know how to properly invoke a non-function

☝️ 1