Fork me on GitHub

@mpenet It'd be sensible, yes. Meanwhile (get (atom {}) :foo (throw (Exception. "no :foo here")))


Are there good/tolerable ways to roundtrip a java object exposing a bean interface in/out of Clojure?


I'm trying to write comprehensible tests of some javabean heavy code in clojure so I can express everything as maps


are others here seeing a timeout error when going to ?


hi, is clojuredocs down for everyone?


damnit I am trying to read up on defn-!


nice, thank you. Was using Dash in the absence of clojuredocs.


is there a way to know if a library supports clojurescript as well when installing it?


Not that I’m aware of. You have to look at the documentation and/or source.


@akiva: but where would I look in the code?


Most everything’s on GitHub.


Well, ClojureScript stuff is going to be in cljs or intermixed with Clojure in cljx files.


Sorry not cljx. cljc.


ah ok yes good point


easy to find out then


and to try to contribute and see if it works I just have to convert it to cljc, change a few things and see if the tests are still passing right?


I guess many libraries would work straight away


Actually, it’s a bit more of a challenge than that. Java and JavaScript although similar in syntax are wildly different beasts.


There are things JavaScript simply doesn’t support. But it’s made much easier to coerce existing Clojure libraries to ClojureScript through the Reader Conditionals.


I mean if at least there is no Java interop it's already a good start I supopse


Hey group, if I have a structure like this:

[{:some-keys 1, :plans [{:id "asdds1"} {:id "asdfa2"}]}
 {:some-keys 2, :plans [{:id "asdf3"} {:id "2313124"}]}]
Is there a better way to get a flat list of the :id values than running (flatten (map (comp (partial map :id) :plans) structure))?


(mapcat (comp (partial map :id) :plans) structure)


Hey all. I am currently using futures to handle fns that only need to be done and not within the context of the fn that is spawning them. Recently the need to handle exceptions in those threads has risen. Is there a reason I would want to use core.async to do these jobs. The alternative is to write my own future macro and wrap the body in a try catch. Any insight is appreciated.


I’ve handled exceptions in a future before. As far as I understand it, it’s required when you want to cancel a future that’s currently in Thread/sleep.


But handling it through core.async seems reasonable.


akiva: is there a reason why you would favour one over the other?


If the exception has to be handled outside of the future, then I’d go with core.async. In my case, the exception is handled within the future itself and doesn’t bubble up at all.


is there a limit to the number of futures you can spawn? Are futures spawned from a thread-pool?


@andrea.crotti: you'll have to refactor the assert-with-message macro, because it tries to create an AssertionError which doesn't exist in cljs. I mean refactor and not just introduce a reader conditional because that doesn't work as you would expect inside of a macro (because macro is compiled in clj, not cljs).


Extracting a fn to introduce the reader conditional there would make it work. Or better yet, remove it altogether... it's there for compatibility with Clojure 1.2, but if you are going for reader conditionals, you'll be in 1.7 at the very least simple_smile


@petr IIRC future uses a single cached thread pool, so will ask the jvm for new threads as needed


@donaldball: can you think of a reason why I would use core.async to catch unexpected exceptions in asynchronous processes rather than just doing this?


Not really. core.async is a useful tool when you need back pressure or efficient selection across queues, it doesn’t seem germane to this use case.


Hello! any example tutorials of how to setup a clojure / clojurescript in the same Leiningen project ? ~ Full stack clojure i found this: but not sure how relevant it is / isn't ... Thanks!


@dviramontes: I think it's not the best idea to post on both #C03S1KBA2 & #C03S1L9DN at the same time. If you think you are not getting attention in one channel, you could post on the other but pointing to the first one... just to consolidate efforts of ppl trying to help


Has anyone installed yeller recently? When I add it as a dependency to an existing figwheel project (without adding any more code to actually integrate it), I get this stacktrace:


@cddr: Might be worth asking @tcrayford


Has anyone used Auth0 with Clojure? Looking for some hints as far as the best way to get started.


We use auth0. We use ha-proxy to route all requests through an app called "auth-proxy" that gets user info from auth-0 and passes the request along to the destination app


@cddr: Is all the communication with Auth0 done from Clojure?


@cddr: Any hints as to a good way to get started with it? I want to get it integrated into a compojure app, so am taking a look at ring-gatekeeper, buddy, and friend right now to see what makes the most sense.


Yeah we use ring-gatekeeper.


Not sure it has the best design though. If I was to start again, I'd probably try to integrate with friend


Ok thanks - I've been looking at gatekeeper a bit and I'm glad it at least works for you, probably going to see about getting it to work with friend or buddy if I can figure it out.


Nice to have a good basic thing to start with though.


Cool. Ping me when you have something. I'd be interested in checking it out


Will do, thanks


@danmidwood: I just tried out specter. I use it to parse a deeply nested data structure that I get while testing our API. It proved useful so far although I know it's controversal. You call would look something like (select [:plans ALL :id] structure)


Oh, that looks like just what I was looking for. Why is it controversial? Too opaque?


I'm still green behind the ears. What I understood is that it's really about building and handling big deeply nested data structures. So Specter eases a pain that maybe shouldn't be eased. On the other hand it's pretty useful. Also it's claims to be 'Clojure's missing piece' isn't received only well. I guess it depends on ehat you're trying to do. I suggest you look into it and judge for your own case :)


Sorry 'its claims' of course


I heard that it's not sufficient for everyone to only have the readme. Additional explanations can be helpful


@tel Uberjarring will not cause a problem with Rook, since it's just about packaging things up in one jar that would normally be multiple jars.


On the other hand, there's an AOT issue wherein namespace metadata is lost during an AOT compile; so if you are combining AOT with Uberjar, just make sure your Rook endpoint namespaces are left as source, not AOT compiled.


That usually isn't a problem, as those namespaces are referenced by symbol name only (in the call to io.aviso.rook/namespace-handler) and so there's no reason for the AOT compiler to normally visit and compile those namespaces.


@hlship gotcha, thanks! I fixed the problem but I’m worried it’s a heisenbug 😕


I hope to be doing more work on documentation & examples for Rook & etc. if and when we start using them here at WalmartLabs.


What is the "right" way to create a helper function that returns a lazy seq from a parser that consumes an input stream"


The problem with this function is that it closes the streams as soon as it has handed off the iterator.


It makes sense.


But is there a way to create a small utility function to create the Lazy Seq


AND guarantee that the streams get closed at an appropriate time?


ajmagnifico: that sort of resource handling is dynamically scoped.


you must use the stream while it's open


you can always do (with-open [...] (do-whatever-processing (line-seq rdr)) and have the function consume eagerly


Note, if you have something Iterable (like the parser), you can just call seq on it, and let clojure protocols do the heavy lifting. (no need to call .iterator/iterator-seq)

Ivan Fedorov22:10:40

Can anybody check me on base64 decoding in Clojure? I have an XML file with inline base64 resources (Evernote's ".enex"), and I fail to decode them. So I copied and pasted one of the resources into separate file (, and tried to decode it using It does create a new file (smaller in size), but it won't open in image viewer. I tried to check the base64 string itself using the link, and it converted the file fine -- a jellyfish displayed.

Ivan Fedorov22:10:08

BEWARE: the base64 source is 10+ k lines long.


ognivo: you on JDK 1.8?


you can use java.util.Base64


(let [decoder (java.util.Base64/getDecoder)] (-> (.wrap decoder your-input-stream) slurp))


something like that, didn't try it


@ghadi: thanks for the (seq parser) tip!


Here's what I ended up with:


I used lazy-seq. It closes the resources when it gets to the end of the sequence


Honest feedback: that will be brittle


If some part of your program doesn't use the whole seq, it doesn't get closed


(There is another way I've not mentioned, yet)


If you have just one file that your processing, the simplest thing to do is to pass a function into something that will open, then call the function on the line-seq, and then close, all using with-open


right, that makes sense


I need to think about my use case a little bit more


A more advanced way to do it, is to make a "reducer"


Kevin downey has a great post on that somewhere


Here is an example of a reducer for file lines

Ivan Fedorov22:10:00

ghadi: thanks a lot, that worked. I used java.util.Base64/getMimeDecoder, because standard getDecoder finds restricted symbol d and dies.


ajmagnifico: But with-open should do the trick, you just have to be conscious about using the whole sequence eagerly. (Add (into []) at the end of your pipeline, or use reduce)


@ghadi: I think you're right. I'm going to have to just wrap everything in with-open and consume eagerly. Thanks for your help!