clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
william 2021-01-30T17:07:25.237Z

good morning! I'd like a suggestion: is there a way of adding specs to functions so that when a function is called, the spec is executed, and if the spec fails I get a complete trace? I checked out ghostwheel (I really liked the co-located queries), but it seems not maintained anymore, and the successor guardrails, on which the documentation for this usecase seems scarce. How do you do this? What libraries would you suggest?

2021-01-30T19:54:26.238700Z

Hello everyone! I'm trying to pass around some quoted code for a dummy project, datalog queries to be specific. I'd have the following:

(def query '[:find ...])

(http/post "<http://example.com|example.com>" {:edn-params {:query query}})
I'm getting an error in the console:
#error {:message "No reader function for tag object.", :data {:type :reader-exception, :ex-kind :reader-error}}
Whats the proper way of passing along ("referencing") the quoted query?

p-himik 2021-01-30T20:57:43.239Z

Figure out what the server receives. Seems like the query has something that it shouldn't have, i.e. a non-CLJS data structure.

p-himik 2021-01-30T20:58:25.239200Z

Or, which should be the same, figure out what the browser sends (assuming you're doing it from a browser). It's actually easier - just look at the Network tab of the DevTools.

2021-01-30T21:32:36.239500Z

If I replace the reference {:query query} with the actually query {:query '[:find ...]} it works, so I don't think there is anything inside the query that is causing problems

p-himik 2021-01-30T21:40:48.239700Z

I have no idea why you would see that behavior then. Are you sure that query inside {:query query} is the very same query as in (def query ...), that nothing rebinds the name to something else in that scope? If yes, then maybe http/post is a macro that does something strange. Apart from that, no idea.

2021-01-30T21:43:05.239900Z

hmmm I moved it back just to check and I'm getting the same error

2021-01-30T21:43:21.240100Z

the query worked before moving it out, I guess I changed something else 😅

2021-01-30T21:43:26.240300Z

thanks

👍 1
2021-01-30T21:43:35.240500Z

would have barked up the wrong tree much longer haha