Fork me on GitHub

Anyone have an idea how to include dependencies for lein javac? I’m trying to write a sample Onyx input plugin in java to test out our protocols and can’t figure out how to sensibly get the onyx dep on the classpath


Oh, maybe it’s just because I’m not gen-class'ing


any recommendations for a real-time graph on a web application?


i'm thinking clojure -> clojurescript (via aleph) -> javascript (d3.js)


@bmay Do you know about (a little bit of spam :P)


ghadi: I have, though not all the way to millions of rows


@niwinz: you might want to change the tag line from "clojure build on" to "Clojure built on"


@ghadi: not sure but I think @otfrom may have used Spark with Clojure (using Sparkling I think - )


@podviaznikov: cool! will be really nice to hear any kind of feedback from early adopters!


Whats a good way to make a function that takes some string and returns a pseudo-random, recognizable thumbnail? Basically like this: but with deterministic results


I found a java library maybe I'll wrap it


@niwinz: Catacumba looks really nice - great doc too.


@escherize: again, very cool, I just created my one


is it bad practice to aot everything when building uberjars? Should I, in general, only AOT the app itself?


@calum Doesn't really matter. AOT-compilation is transitive, so anything your app depends on will be compiled along with it.


@stuartsierra: oh ok, it's just I ran into some namespace conflicts and not AOT'ing everything fixed it. I was told AOT 'can cause lots of problems', so I was wondering why it's on by default.


@escherize: I think I may have used that piece as a starting point.


AOT tends to cause problems with interactive development, e.g. reloading AOT-compiled sources at the REPL.


This issue was with building uberjars, normal compilation was fine


a benefit of AOTing everything is that your app doesn't have to compile when it's booting in production (which makes restarting faster)


ah ok, I'm still very new to clojure and had never heard of AOT compilation so I'm just trying to get my head around the pros and cons simple_smile


AOT compilation definitely has issues. Some libraries don't work at all if you AOT compiled them. I believesome of these issues have been fixed in clojure 1.7


CLJ-1604 made my app not compile (one of the deps broke). Fixed now though simple_smile


ok so I guess I just need to be vigilant about that


a thing I'd recommend is trying to boot your uberjar during your CI process. It'll catch anything like that

Busy escaping the comfort zone14:06:27

I separate AOT using lein profiles, that way I can use in dev env and compile while releasing the jars


I personally prefer AOT only the entry point namespace. This allows avoid all the AOT related problems. My two cents.


I only AOT when using an uberjar.

Alex Miller (Clojure team)14:06:46

stuartsierra: there has been a change (CLJ-979) in classloading wrt checking the dynamicclassloader class cache - this "fixes" some scenarios with repl reloading and AOT by preferring the more recently redefined deftype. However these changes also negatively affect some other issues (CLJ-1741 is one example).

Alex Miller (Clojure team)14:06:21

However, I think the "solution" there is really to go back to address things like CLJ-322 (transitive compilation) and also reconsider whether \compile-path should be on the classpath (I now firmly believe it should not be, despite other instruction to do so)

Alex Miller (Clojure team)14:06:43

that is, calling "compile" should produce outputs somewhere, but you should not further consume those outputs while compiling. Rather, compile will have the same side effects as load on your runtime environment (causing classes to be loaded etc)


@alexmiller: interesting idea. Sounds like it would be worth trying at least.

Alex Miller (Clojure team)14:06:34

I have tried it, and it works pretty well. hard to be exhaustive about anything of course.

Alex Miller (Clojure team)14:06:38

I went back and read some of the irc logs from Rich, etc back when this stuff went in and I do not think the reasoning behind having compile-path on the classpath holds up in retrospect. We have better solutions to the dynamic classloading issues now than when that decision was made. The problem in CLJ-1741 is really hard to solve with that in play.

Alex Miller (Clojure team)14:06:18

(some day I will reclaim all the space in my brain reserved for memorizing these jira ticket numbers and will do something useful with it)


@alexmiller: thanks for Clojure Applied. I’m really enjoying it!

Alex Miller (Clojure team)15:06:53

you're welcome! hopefully the in-print version is not more than a couple months off.


that’d be nice, but the PDF /epub ones are very readable on a MB Retina simple_smile plus I can copy/paste from the PDF, which is a plus simple_smile


i tried following along on the “go shopping” example but got stuck — saying that I see you’ve fixed some issues I reported around that in B4, so I should try again...


Anyone got experience custom tags in Selmer? I’m trying to feed a template variable into a new custom tag {% new-tag var %}. I made sure the var carry the value by {{ var}} in the template and also done (var :var {var} {{var}} ) inside the {% %}. Am I missing something obvious?


common lisp and emacs lisp run above code correctly, but clojure throw stackoverflow exception


Do you really need a macro for that in Clojure?


there's no tail recursion in clojure.


Also that.

Busy escaping the comfort zone16:06:19

for small n it should work

Busy escaping the comfort zone16:06:43

but in this case its related to the macro


it doesn’t matter with n


it doesn’t matter with n

Busy escaping the comfort zone16:06:40

I think that somehow the fact there your trying to use the macro within its own definition causes it to blow up

Busy escaping the comfort zone16:06:53

not sure that clojure supports recursive macros

Busy escaping the comfort zone16:06:09

so its trying to expand indefinitely?


I watched this code, so, write above test


Macros can call themselves, clearly, but even in regular functions loop/recur is preferred over directly calling the function.


(walk/macroexpand-all '(sum-1->n 10))

Busy escaping the comfort zone16:06:48

akiva correct but the JVM can support non tail recursion up to the JVM stack limit


will throw stackoverflow exception


will throw stackoverflow exception


@narkisr: True but then you end up with situations like this. Heh.

Busy escaping the comfort zone16:06:33

akiva correct usually its not safe to do so


How macro expand in common lisp


I still say this should be a function rather than a macro and the loop should be handled with reduce where you can produce a range with n and dec.


why common lisp(emacs lisp) do not throw exception?

Busy escaping the comfort zone16:06:21

I guess they have a smarter macro expansion code

Busy escaping the comfort zone16:06:54

is there a strong use case for such macros?


I just written it for test

Busy escaping the comfort zone16:06:19

Nice finding, its cool what you can learn from just reading the source simple_smile


isn't sum-1-to-n #(/ (* % (dec %)) 2)


@voxdolo: I'm also looking at Clojure Stripe libraries, I'm working on an example project (haven't pushed code up to github yet though) using stripe-clj. sorry my example repo is bare because I got called on to do a real app using stripe so I'll copy,paste,munge the code as I go.


before I hook up all of the backend stuff that will actually make them money, the business users always want to make sure that the front end looks really good and is reactive and web 2.0 and buzzwords etc.


@gary: cheers, I believe I stumbled across it yesterday whilst searching github. Didn't have a look then, will now simple_smile


is it generally better to use (make-hierarchy) or add parent-child relationships to the global hierarchy? How would I make this decision?


@gary: oh, hah! just looked and caught what you meant by it being bare 😄


@cpmcdaniel: Doesn't matter much. Hierarchies are very rarely used at all. The global hierarchy implicitly includes the Java class inheritance relationships.


@gary: I tend to avoid all libraries that are just wrappers on clj-http


@gary rarely worth the trouble


@arohner but in this case it's worth it?


@gary last time I used stripe, I ripped out whichever wrapper library it was, and just used clj-http directly


that was a while ago though


but I have a long history of removing http wrapper libraries 😉


github, twitter, google. doesn’t matter


the author always forgets to include some parameter you need, and then you have to use both, or rip them out


@arohner: or submit a patch lol


this reminds me of a java client for the docker API that I was evaluating and then for fun, I implemented some of the stuff in clojure, thinking, uhm, there is no need for a wrapper fo any sort, just use clj-http for each call and you're done


How do I run this code in lein without exiting from the jvm?

(ns hello-world.async-test
(require '[clojure.core.async :as async :refer :all])
(require '[clojure.repl])

(defn -main [& args]
  (doseq [i (range 10)]
  (go (while true (let [random (rand-int 10)]
                  (println "Random ::" random))))

I want to use lein trampoline run command and watch JVM using jvisualvm


(I submitted something and then incorporated 7 or so ideas from other submissions.)


@mohan: go returns a chan containing the result of the loop, when it exits. take from that, something like


(let [result (go …)] (a/<!! result))


Is there such a thing as a lazy map in Clojure? As in, a map where the value is only calculated when the key is accessed.


I could be wrong but you can probably assign as a key’s value a lazy sequence.


Now that I’ve typed that, my confidence has diminished greatly.


Hi, The at-at library seems abandoned. Which function scheduler do you recommend?

Busy escaping the comfort zone22:06:13

Your welcome, it rather small code wise and optionally uses channels, the joda times integration is nice also


@akiva worth a try, but I'm skeptical to be honest


As am I. Try it and report back with your findings.


Maybe if manually extend a hashmap


@malabarba: you can totally have lazy seqs and other things in a hash map as values


@malabarba: there is no structure I know of in which the mapping itself is lazily computed.


although I suppose you could invent such a thing for some inputs...


@akiva alas, I'm actually in bed right now. Testing will be done tomorrow :-)


something something equivalence of maps and sets to functions grumble types


@arrdem i mean, the idea is that all the keys would be known ahead of time, like a regular map


But the values would be calculated the first time they are accessed


It's certainly possible in theory.

Busy escaping the comfort zone22:06:12

Why not have a map that hold partial applied functions?


Just For the syntax.


I'd like to be able to do (:some-key the-map) to get the value. Whereas, if the values are partially applied functions, I'll have to do ((:some-key the-map))


It's not a huge deal

Busy escaping the comfort zone22:06:56

You could implement the associative protocol (I don't recall its name) and extend so on get it will call the function


That sounds promising

Busy escaping the comfort zone22:06:11

Most of the implementation will just delegate, only the get stuff will call the function


Yeah, I think that's it. Reading into it now, and will try tomorrow.

Alex Miller (Clojure team)23:06:36

@arrdem and @malabarba Datomic entity maps are lazy like you're describing

Alex Miller (Clojure team)23:06:36

Not that that is useful in solving your own problem of course :)


Good to know anyway :)

Busy escaping the comfort zone23:06:14

I'm on the lookout for a secure over the WAN messaging protocol/implementation (for Clojure of course), iv already considered Zeromq (lacks security for the JVM) MQTT (requires a server which id rather to avoid) or SQS (tying me to Amazon)