Fork me on GitHub
Mario C.02:08:16

My profiles aren't merging correctly or at all. I can't figure out why. I have {:profiles {:dev [:project/dev :profiles/dev], :profiles/dev {}, :project/dev {:dependencies [["dependencies list here"]]}}} in my project.clj and have this {:profiles/dev {:env {:happy-hour? true}}} in my profiles.clj but when the app starts (:happy-hour? env) returns nil.


You have :profiles/dev {} in your project.clj which will override the profiles version

Mario C.02:08:40

I got rid of it and its still not picking up the env variables. Which is odd since it works fine in another project. Which I am copying the project.clj structure from


dunno... I stopped using leiningen years ago :rolling_on_the_floor_laughing: ¯\(ツ)

Mario C.02:08:55

oof lol I guess I gotta keep looking

Abhinav Sharma06:08:05

Hi guys, has anyone tried solving leetcode problems in clojurescript and managed to get the compiled output passing? It seems the solution size limit is <100Kb and often the compiled CLJS output, even with :optimizations :advanced gives 100Kb size. Really curious about this 🙂


> Is there a way to evaluate something at the REPL without it affecting *1 et all? Sorry for the nagging. I don't know how to figure this out. I need something that works for both Clojure and ClojureScript (or if it is two different ways, that'll work as well).


> Is there a way to evaluate something at the REPL without it affecting *1 et all? Sorry for the nagging. I don't know how to figure this out. I need something that works for both Clojure and ClojureScript (or if it is two different ways, that'll work as well).


how come you don’t want it to affect *1 et al?


It's for Calva (a Clojure dev environment). It supports to evaluate forms from editor files to the repl prompt. To be nice to the user the form is evaluated in the file's ns and then the repl prompt's ns is restored. It is pretty neat. But a side effect is that *1-3 are affected by the in-ns evals.


(And the user does not even get to see those evals, so major confusing.)


I am developinng an app with clojurescript but I didn't touch clojure at all. I found a nice crawler I tried same way like I would do in CLJS but I can't run it in repl what I am doing wrong?


@m373h4n does this work for you?

(require '


user=> (require '
user=> (
CompilerException java.lang.RuntimeException: No such var:, compiling:(C:\Users\Root\AppData\Local\Temp\form-init6063905182774601959.clj:1:1)


it says like this


i started repl with lein repl maybe this is wrong ?


stop your repl, then do lein repl again, then

(require '


when you used ns you redefined the namespace to an empty namespace. use in-ns to avoid that


thank you this time it worked


in-ns also creates a new ns, use require before in-ns


yeah. I find it much more obvious with in-ns though, as not even clojure will be there 😛 if you happen to use in-ns before require by accident, you can always do (clojure.core/refer-clojure) to have the core functions available, or just (in-ns 'user)

David Pham11:08:52

Anyone could point me how you could adapt the make-component code in this file ( following the advice from the official wiki page (

David Pham11:08:08

Basically, how do you extend a JS class in cljs?

David Pham12:08:00

Just need to know how to google long enough

Sy Borg15:08:01

can anybody please show me a code sample, I'm stuck... given an integer number produce a sequence of its digits (not using string conversions)


I'm not sure exactly what you mean

123 => (1, 2, 3)
is that an example of input/output you are trying to get

Sy Borg15:08:52

yes (probably using `iterate'?)


(loop [num 123
             digits '()]
        (if (pos? num) 
          (recur (quot num 10) (conj digits (rem num 10)))


From what I remember, this problem is generally solved using the modulo operator and a loop to break out the various digit places.

Sy Borg15:08:47

I was thinking of smth like take-while #(not (zero? %)) (iterate #(somefunc) n) where somefunc uses quot/`rem`


hi guys, is there a book like the clojure version of "Effecive Java" ?

gerred17:08:41 is a good one, maybe Joy of Clojure as well?


@U05509S91 yeah, Clojure Applied is an awesome book , haven't read Joy of Clojure, will grab a copy , thanks for the recomendation

Jp Soares15:09:54

But is sad that Clojure Applied doesn't talk abut specs. Would be awesome to have another edition including specs.


thanks for the recomendation , just bought a copy


It's a good one although it often feels like too abstract (especially chapters 3 and 4 would benefit from having more elaborate examples). I love it but I always feel like it should have been 3-4x longer book 🙂


hi, I'm running into a silly issue that I can't understand,

(#(concat (take (- 1 %2) %1) (nthrest %1 %2))  [1 2 3 4 5 6 7 8] 3)  
 (4 5 6 7 8)
when running this code the take function returns an empty seq but if I put a value instead of the calculation it works


why are you passing a negative number to take?


did you reverse the args to -?


anyway, if you give take a positive arg you'll get a non-empty result


too much time looking a the same thing


there's also dec if you want a bit clearer way to write it


also if you switch nthrest to drop, the parallel with take is more obvious, and they can both use their args in the same order


(drop is just flipped nthrest)


ooh cool, I though drop , didn't take an idx


can i use doseq to walk through dictionary entries? i thought recursion would be best but it turns out it's just an xml file one layer deep really


"dictionary entries" are not a Clojure data structure. Are you asking about a Clojure map, or some other Clojure data structure?


doseq can be used to iterate over any of the fundamental kinds of Clojure collections: sequence, vector, list, map, or set. Note that doseq is intended for performing side effects in its body, since the doseq expression itself always returns nil. You may want for instead, which can return new sequences.


it's a vector


mm for returns a new sequence... cool


thank you kindly, will investigate


hmmm my for doesn't work?


(for [dk jmdict]
	(println (:tag dk))
	(println (:content dk)))


where jmdict is a vector coming in


Caused by: clojure.lang.ArityException: Wrong number of args (3) passed to: clojure.core/for


The body of for must be a single expression. It is used to return a value


@sova for is lazy -- make sure you are actually consuming all of the result


For println, which is a side effect, you may want to use doseq


Good point re : single expression!


ohhh o.o could you please elaborate a bit?


The body of your attempted for consists of two expressions, each a (println ...)


That is one too many, for the body of a for expression.


Is that what you wanted elaboration on?


ah okay, so it could work if there was only One println


yeah, and for is good for returning a sequence then, like doing a transformation


If you want to take some collection, do some processing on it, and return a value, you may use for to do that. It returns a sequence, and in the simplest case for returns a sequence containing one element for each of the input sequence's elements, and that element in the return value is the value of the body of the for expression.


style-wise, when do you prefer for to doseq?


If you know your goal is only to do some side effecting things, like println, then doseq is closer to the intended use.


Ahh that makes a lot of sense, so the body of the for loop will become each individual result in the result vec


I learned today that recursion is so cool and often not the answer! lol


println always returns nil. If you use println as the body of a for expression, you will get back a return value that is a sequence consisting of one nil per element of the collection you iterated over (more generally, once for each time for evaluates its body).


Oh wow, I see


That is often not a useful return value.


Right. Very good to know this distinction


doseq returns nil -- so it is only for side-effects; for is lazy and returns a value (so it should not be used for side effects in general).


Also, as Sean mentioned, for is lazy, and doseq is eager.


Ah okay, that's cool to know as well.


Great! I've made a lot of progress thanks to y'all in just a few minutes! Thanks again


@sova Sometimes it's helpful to think of it this way: (for [x coll] (f x)) == (map f coll) and (doseq [x coll] (f x)) == (run! f coll) -- that breaks down as soon as you have more than one collection being iterated over but it might be a helpful meme for remembering the basics?


(it's not an exact equivalence but...)


hi, I’m doing exercises at and my solution works on the repl but not the site, the problem is reverse interleave, here’s the code

(fn [coll n] (map #(reverse (into () (take-nth n) (drop % coll))) (range n)))
any idea why??


nevermind got rid of the into


funny enough, (into () coll) is a decent way to implement reverse


especially if you also want to transduce while reversing like above