Fork me on GitHub

Hi, any guidance on setting up a rest api using datomic? I see ring and some other libs, any pointers on where I should start?

Petrus Theron10:09:44

Is it possible to easily use NPM libs from Cljs? E.g. I want to use this Firebase Queue Worker thing, but without writing JS:


Hi, how I can escape double quotes sign (") in clojure string?


str.replace(/\"/g, '\\"') analogue in JS


(defn escape-double-quotes [str]
  (s/replace str #"\"" "\\\\\""))


@petrus it’s not straightforward, there’s some ongoing work that will make it simpler for build tools to consume NPM, but it’s not going to be an officially supported thing.


in the case of Firebase you shouldn’t need NPM anyhow,


@curtosis it’s not desirable to write a function for those cases, you want Google Closure to optimize that stuff. If you’re actually dealing with JSON data then there’s goog.object which has all the helper fns one would need.


how do you specify that something should be a map with prismatic schema?


Not 100% sure, but I think you could do something like:

(def GenericMap {})


Hi everyone, I’ve came across this code from README

(runtime/send-message msg {:extensionId “some..”})
which is implemented with (
(defn send-message [message & options]
  (let [{:keys [extensionId options responseCallback]} (apply hash-map options)]
So the implementation says the proper usage is in fact`(send-message msg :extensionId “some”…)` which contradicts the readme. It feels weird to me to pass around options like this, especially since message will mostly be a hashmap, so it’d be better written like in the readme. Which one do you think is the most meaningful/idiomatic ? (send-message msg {:foo “bar"}) or (send-message msg :foo “bar”) ?


Do you know the keys in the map?


@dnolen: thanks! I figured there had to be a good reason ... too many of us Lispers around to leave something like that un-abstracted repeatedly. 😉


trying to understand how transit works - if msg is the string representation of a ClojureScript map (sent from client to server using transit-cljs and a websocket) what is the simplest way to parse msg back into a Clojure map on the server side?


@paulb not sure I understand the question. If you use transit-clj and transit-cljs there isn’t anything to do, it just works


I got it working by doing (t/read (t/reader (ByteArrayInputStream. (.getBytes msg)) :json))


I find it confusing with transit-clj write is an impure function that returns nil whereas with transit-cljs write is a pure function that returns the result you need (same with read)