Fork me on GitHub

the trick here is that an interface can't extend anything, but two things extending the same interface or protocol is how we tend to do things


also composing interfaces - implementing multiple interfaces to make one thing


The question I meant to ask: Should I be using :import or require for goog.fx.Dragger. My thought is that it should be import because Dragger is a class. see


but then this class also has enums that can be imported at Dragger.EventType


To take this thought to the next step, what happens when enums from different class have the same names like:

[ EventType]
[goog.fx.Dragger EventType]
The above won't work because the second EventType overwrites the first. Would this mean we just have to do the following:
and then reference the full name each time?

Chris Bidler02:04:41

@tkjone You would be able to get away with importing one of the EventTypes while using the other one’s full, namespace-qualified name

Markus Åkerlund Larsson08:04:43

Anyone know much about Cursive? I can't get Clojurescript to work in the REPL. It'll load files fine as long as they don't use any external libraries.


Hey! I am using cljs-ajax like this :

(defn signin
  "Try to signin using email and password"
  [{ :keys [email password handler error-handler]}]
  (POST (str uri-host "/users/password_signin")
              {:params {:email email
               :password password}}
               :format :json
               :handler handler
               :error-handler error-handler))
to post json, and it sends transit, not json. Is there anything wrong with this? Used ajax-request, and it worked. very strange :thinking_face:

Fahd El Mazouni11:04:30

is there someone with bigquery experience ?


@troglotit Looks like :format, :handler, and :error-handler aren't part of the options map


Not sure what you mean. In your example those parameters aren't included in the map literal {}


Hi there! Anyone know what this means? Uncaught TypeError: Cannot read property 'ReactCurrentOwner' of undefined How can I debug the advanced-compiled reagent/re-frame-app?

Surya Poojary13:04:35

(read-line) can read integers as well ?


read-line reads strings

Surya Poojary13:04:31

For reading ints

Surya Poojary13:04:16

read-int is not valid


read the input as a string and parse an int from that string


using e.g. Integer/parseInt


you can define read-int like so:

(def read-int (comp (fn [s] (Integer/parseInt s)) read-line))

Surya Poojary15:04:38

Thanks for the reply !

Surya Poojary16:04:34

Is that function anonymous


yeah, it shows up in stack traces as

clojure.core/comp/fn core.clj: 2560
boot.user$fn__2470.invoke    :    1


to have it show up as boot.user$read_int.invoke you can define it fully like (defn read-int [] (Integer/parseInt (read-line)))

Charles Fourdrignier13:04:54

How do you write and store your doodling ? I write little code with data.csv and spec-provider to explore some files. Not something I really want to put in an application, but I would like to put in a repository for futures explorations. I create a “app” with leiningein with seems overkill, but that’s the only way to write Clojure I know at the moment. Maybe I should look at deps.edn, ... ? Do you have some good pointers (blog posts, articles, ...) on the subject ?


yeah deps.edn is much lighter; the official docs are good:


I like that you can use clj to fire up a REPL with a set of dependencies in the command-line arguments, so you don't need a "project".


It's one of the things I really like about Boot vs Leiningen.


There's lein-try, but then you need that in your personal config etc.




boot -d some-group/the-artifact repl
will fetch the latest (non-snapshot) release of that project and fire up a REPL with it. With clj you can do
clj -Sdeps '{:deps {some-group/the-artifact {:mvn/version "RELEASE"}}}'
but that's a lot more verbose.


I also like that Boot lets you load new dependencies at runtime into your REPL, so you don't have to stop your REPL, edit some file, start the REPL back up...


I think Boot is a lot more beginner-friendly -- but Leiningen is older/more established, so nearly all the tutorials out are written for lein ¯\(ツ)


and there's the fact that tools like Figwheel are tied to Lein (i think?)


Hmm, I thought I'd seen folks talking about Figwheel in #boot (but I don't pay much attention to cljs stuff).


well, i just use adzerk-oss/boot-reload, but bhauman/lein-figwheel (naturally) only mentions Lein, and boot-clj/boot-figreload is incomplete according to the readme. perhaps there's a way to use figwheel-sidecar with boot, but i never really looked into it 😛


the new figwheel-core being worked on works with clj though, so that would probably work with Boot too

Charles Fourdrignier14:04:25

@seancorfield Thank you for all this feedback ! (I should activate some mails notifications, I don’t open Slack during 3 days and nearly miss you response.) I need to say I love this community, so helpful, so beginners friendly.


@timok I’m not sure exactly what your issue is, but based on some googling, I’m seeing reports of people getting this error when they have multiple React libs with different versions, especially React 15 vs 16. Try lein tree :deps to see if you can spot any conflicting React versions and if lein recommends any exclusions.


@U06CM8C3V Hi! Thanks for the reply. I was already looking into this and really, I am feeling lost here. I changed a lot of stuff now to get back to a running state.

👍 4

lein deps :tree does show me a lot of advices but there is nothing about react. Is it possible that google closure is the issue here?


I don’t know enough about it to really tell, unfortunately. I tend to doubt it though, sounds like something inside React is unhappy


maybe when I exclude react for a specific library? that this library needs e.g. a newer version?


Are you excluding any libraries at the moment?


not anymore


I now explicitly require the exact versions from reagent 0.7


but I did exclude react and react-dom from semantic-ui and react-datepicker


And that fixed it for you?


no not until now...maybe I need to systematically approach this and try all the combinations...but the thing is, that running the uberjar on its own works and when deploying it to a server it does not and that's an indicator that it has to do with something else...


the deployment is not really automated and it takes me hell of a lot of time


that's it


kind of works now...but no idea why...with these specific react dependencies and no excludes...aw_yeah


Sounds good. Sometimes I think removing a dependency might leave behind bits of code that should have been removed. The weirder things get, the more I do lein clean, out of sheer paranoia.

😆 4

@c09mld try #cursive. the author hangs out in there.

Daniel Hines16:04:15

I'm trying to use clj-http's convenient :as :json option to turn JSON into a Clojure map, but the OData endpoint I'm using returns annoying JSON field names like "[email protected]". Some functions seem to handle it just fine, but things like keys or map blow up because of the "@". I need the data the keys provides, and the keys are dynamic, so I can't deal with each key specifically. Any ideas on how to succinctly deal with the bad characters?


I think you need to use string key instead of keyword keys. so :as :json-string-keys

Daniel Hines17:04:49

Ah, ok. That would solve it. Thanks!


@d4hines also, (keyword "[email protected]") does work - but much better to use strings instead of keywords for that kind of data

Daniel Hines18:04:00

Ok, cool. Fortunately, :json-string-keys is working beautifully.

Kari Marttila18:04:40

I'm pretty puzzled how to use cljs-ajax library correctly. I have implemented a Clojure/Ring backend and tested with curl and Postman that both the GET and the POST interfaces work properly. I have configured the required cors settings. In ClojureScript frontend when using the cljs-ajax library to send a GET request everything works properly. But when sending a POST request (a map of a couple of key/value pairs as json) I get reply: XMLHttpRequest cannot load <POST url>. Response for preflight has invalid HTTP status code 400. And the weird thing is that the browser seems to send OPTIONS instead of POST. I'd be happy to find some working example to check what I have misunderstood.


@kari.marttila are you sending your GET and POST to the same url specified in exactly the same way?


unlike curl, a cross origin request needs a preflight and cors setup


it will send OPTIONS first iirc and the backend has to be ready to cooperate


oh GET doesn’t require preflight


that’s why the different behavior


> The CORS specification mandates that requests that use methods other than POST or GET, or that use custom headers, or request bodies other than text/plain, are preflighted.


(quote from my above link)


@kari.marttila the root of your problem is not cljs-ajax, it’s that you just don’t have cors setup correctly

Kari Marttila18:04:57

Ok. Thanks. I'll investigate the issue now that I now what to fix. Thanks. 🙂

Kari Marttila18:04:49

@lee.justin.m and @noisesmith: Any suggestions what should I add in the Clojure/Ring application side? I have currently configured the cors settings as: (assoc-in [:headers "Access-Control-Allow-Origin"] "*") (assoc-in [:headers "Access-Control-Allow-Headers"] "X-Requested-With,Content-Type,Cache-Control") (assoc-in [:headers "Access-Control-Allow-Methods"] "GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS") (assoc-in [:headers "Content-Type"] "application/json") (assoc-in [:headers "Access-Control-Max-Age"] "1728000")


@kari.marttila Have you looked at the ring-cors middleware to do this automatically for you?


(let [h (ring-cors/wrap-cors handler
                               :access-control-allow-headers #{"accept"
                               :access-control-allow-methods [:delete :get
                                                              :patch :post :put]
                               ;; 24 hours (in seconds) -- note that only Firefox
                               ;; will honor this; other browsers cap lower!
                               :access-control-max-age "86400"
                               :access-control-allow-origin #".*")]
    (fn [req]
      (h req)))
for example


(It doesn't improve the configuration much over what you're doing manually, but it handles the OPTION preflight check automatically)

Drew Verlee19:04:48

Maybe this should be obvious, apologies if it is, with the clj tool is there a recommended way to integrate clojure.test?


@drewverlee Did you see my dot-clojure deps.edn file? I posted the link to GitHub in a few places...


clojure.test is "built-in" (part of the main Clojure JAR) so you can just use it in code without additional dependencies -- so the key steps with clj are: adding test as a path (or wherever your test code lives) and adding some sort of test runner (such as Cognitect's test-runner project). --

clj -A:test:runner
lets me run tests


clj -A:test:runner:1.7
will run tests using Clojure 1.7, for example


I separate the test paths/deps from the runner so that I can start an nREPL server with tests on the classpath

clj -A:test:nrepl

Drew Verlee19:04:06

Yea. Thanks @seancorfield. I somehow missed it in the offical docs to:


(hmm, I don't have Clojure 1.7 in my deps.edn but I do have that alias in core.cache and core.memoize which both use clj / deps.edn for local dev/testing)


So, multi-version testing of core.cache is

for v in 1.6 1.7 1.8 1.9 master; do clj -A:test:runner:$v; done

Kari Marttila21:04:54

Thanks @seancorfield! I'll try that tomorrow. It's already midnigh in Finland, got to go to bed.