Fork me on GitHub

does anyone have experience with ssl on heroku?


i have an api running on immutant


apparently its stupid easy lol




hello! I'm confused about project dependencies when linking to clojure from another JVM language; I've articled my problem/question fully here: If anyone could help that would be greatly appreciated 😄


@dadair I have similar setup for two projects. I have Clojure code compiled as überjar, intended to be used as a library from Java (and some Java classes calling the Clojure code - :gen-class won't create javadoc for classes/methods and my colleagues would be upset 🙂 ). I ended up with embedding nREPL in the project. I copied code from this library: . From Java code I call the Clojure method to start repl during application start. Then I can connect to that from emacs.


I'll second that. For a long time -- as we introduced Clojure into our stack -- we used the "Java API" to call Clojure from our legacy application and we started a REPL server inside that code which we could connect to from Emacs or the command line and have our regular fast-feedback Clojure workflow.


so to use clojure in a legacy codebase with coworkers who don't want to use java, you are: 1. compiling *.clj iknto uberjar 2. when the uberjar is called from java, firing up a nrepl 3. so now you have a clojure repl into your legacy java app (that still "starts from java") ?


One thing I'll observe is that we deliberately did not create an uberjar and deploy things that way -- we decided to deploy as source and put the src folder on the classpath of the legacy application (along with any Clojure libraries we needed). This meant we could modify source if needed and require :reload to pick up changes (I'll say that we rarely do this now, but it was common when we first started embedding Clojure).


The progression for us was that we started using Clojure as a small, isolated "library language" for low-level stuff and it gradually expanded until it became our primary language. Now we do all new development in Clojure and our legacy systems are shrinking as we replace functionality with pure Clojure microservices and applications.


What is the best way to type hint an Object[] array in Clojure? I've seen this method #^"[Ljava.lang.Object;" here (, but I'm not sure it's officially supported.


@val_waeselynck Check out to-array source.


@val_waeselynck ^objects works as well


@U088T6UDC thx! weird that it's not in the official docs

Alex Miller (Clojure team)13:12:40

That will not work on vars by the way, only in signatures


What’s the rationale behind nthrest? Noticed it for the first time today. What about (drop n ...) wrapped in doall if you need it strict?


Interestingly, they both seem to have a recur pattern that is eagerly done to consume the beginning of the sequence.


so the difference is nthrest skips n immediately and drop only when the sequence is consumed


nthrest is eager initially, while drop staves off the initial eagerness


hmm yeah, so (doall (drop ...)) would consume everything in the dots too, while nthrest leaves that to the consumer of the seq


You do have an interesting question regarding rationale, especially given that nthrest wasn't added until 1.3


maybe (drop ...) caused an issue in the impl of partition?


@borkdude If you are curious as to my rationale for using nthrest: It was simply that I had used rest (instead of (drop 1 ...), so when I needed to revise the code to drop more items, I reached for nthrest without thinking about it too deeply. I certainly wasn't thinking about laziness, whether to employ transducers, or any such deeper analysis.


Yeah, when I saw your code I started thinking about transducers. It lends itself well for it. But whatever, that’s not better or worse, just different and maybe overthinking a puzzle 🙂


FWIW, I think your final solution using drop is the cleanest, easiest to read, especially given that the revised code needed to drop more than 1 item.


There is also an argument that some functions are a bit esoteric (and perhaps should be avoided). drop is used 50 times more frequently than nthrestin the data in My favorite example Var in that category is when-first. It is hard to justify using when-first given that it never became part of the "idiom".


Never heard about it


nthrest is also not used in the rest of the clojure codebase


Indeed, that's the problem with using Vars like that. It is like using a "dictionary word" in conversation, where the other participants in the conversation get stuck on what you just said.


Not good for readily understandable code. 🙂


Maybe that’s the problem with Specter too.


Or Clojure. 😛


Ah, @alexmiller replied: it’s probably about holding the head

Alex Miller (Clojure team)16:12:33

or simply avoiding calling first on anything for cases where that realizes things


How would I write this more concisely? (let [d {:a [{:b 1 :deleteme "foo"}]} f #(dissoc % :deleteme)] (update-in d [:a] #(mapv f %)))


update is now in core for updating when the path [:a] only has one segment.


your code seems fine to me


Seems fine to me too with update.


If you are directly indexing :a you might not mind numerically indexing its array using medley's dissoc-in:


(let [d {:a [{:b 1 :deleteme "foo"}]}]
  (dissoc-in d [:a 0 :deleteme]))


But if you have more than one element in :a I would just inline the lambda instead and use update as bork suggests:

(let [d {:a [{:b 1 :deleteme "foo"}]}]
  (update d :a (fn [m] (mapv #(dissoc % :deleteme) m))))


@mbertheau with specter: (setval [:a ALL :deleteme] NONE data)


Anyone here familiar with a javalib which compresses animated gifs, similiar to what Guetzli does to jpgs?


(clojure libs are valid too, but we're more of a wrapping kinda people)


probably anything you find would be a wrapper.


I don't know of anything, but if there is a C library that does what you need, it's straightforward to wrap C, and pretty pleasant using JNR-FFI


you don't have to write any C glue manually


What do you do in clojure spec to generate sample (gen/sample (s/gen ::foo)) with unique value like code. Do you make own function for code generation or is some simpler way?

Alex Miller (Clojure team)17:12:47

you can use s/with-gen to supply a custom generator when you define a spec

Alex Miller (Clojure team)17:12:10

or supply an override generator function when a spec is used in places like s/exercise, stest/instrument, etc


yes, i was thinking about s/with-gen. Not sure what you mean by override generator. Probably i don’t know about something 🙂

Alex Miller (Clojure team)17:12:57

functions like s/exercise take a map of spec name to generator functions that can be used to override the generator for a spec just in the context of that call


oh i see some things changed in the doc from last time when i saw it, thx

Alex Miller (Clojure team)17:12:59

user=> (s/def ::i int?)
user=> (s/exercise ::i)
([0 0] [-1 -1] [1 1] [-1 -1] [-6 -6] [-6 -6] [-4 -4] [2 2] [-2 -2] [-56 -56])
user=> (s/exercise ::i 10 {::i (fn [] (s/gen #{5 10}))})
([5 5] [5 5] [10 10] [5 5] [5 5] [10 10] [10 10] [5 5] [5 5] [5 5])

Alex Miller (Clojure team)17:12:16

the docs have been out of date for a very long time but I refreshed them last week

Ryan Radomski20:12:38

In Stuart Halloway's talk Simplicity Ain't easy, at the end he mentioned that there is some interesting discussion about design foundations other than simplicity. I can't seem to find any more information on it. Does anybody know of any discussion on that?

Alex Miller (Clojure team)21:12:44

@radomski the three ones from Rich and Stu are power, focus, and simplicity

Alex Miller (Clojure team)21:12:39

I think Stu has done talks on two of those (see also )

Alex Miller (Clojure team)21:12:38

Maybe some day he will complete the trilogy and then we can get into the prequels


just wait, he’ll use CGI to add realistic concrete inheritence when he re-releases the original