Fork me on GitHub

Actually, digging a little more into Clojure's compiler source code (in Java), it is also likely that it is wrapping try and catch bodies inside (fn ...)


for a number of different more complex expressions (try/catch, loop/recur, etc) if that expression isn't in the tail of the function, or in the middle of the do (the compiler calls these contexts, and those two are return and statement contexts respectively, the alternative is expression context), the compiler will hoist the code out in to an immediately invoked fn


I have a patch on a jira issue somewhere that changed that to hoist them out as static methods on the fn's class, but the patch still doesn't work right (it interfered with local's clearing), and it was a real pain to do given the single pass nature of the compiler


(despite it not actually working, it is still my favorite patch)


Hello, i've got an utils library that i would like to :use everywhere (implicitly), what is the way to do so with leiningen?


@pbaille The simple answer is "you can't" -- and I'd say you really shouldn't even if you can figure out a way.


Clojure favors more explicit approaches -- which is why :use is considered bad practice, along with :refer :all.


@seancorfield thank you for your answer, i understand. even if sometimes, i have to admit that i'm tired to always rewrite mapvals or things like that... but it's ok 馃檪


also, i'm wondering what is the rational behind

(merge {:x 1} [:y 2]) ;=> {:x 1 :y 2}


Well, Clojure often defines the behavior of a function only for certain types of input -- and other inputs may or may not given sensible output. Some people call that garbage-in, garbage-out. Others just call it undefined behavior 馃檪


It's part of what allows Clojure to be fast in the good cases.


merge is defined on maps, only.


ok, i understand, thank you!


It's implemented in terms of conj however, and that just happens to be able to add vector pairs or MapEntry objects into a map.

Karol W贸jcik12:10:30

(sh "git" "clone" "[email protected]:clojure/clojure.git")
Why output is in :err? It seems like a bug in git command WDYT?


i think it's related to the practice of outputting nothing on stdout when everything is successful


so then when you do git clone foo | baz bar, it still prints its output to the console, rather than piping to the baz bar command

馃憤 4
Karol W贸jcik13:10:45

馃槷 Had no idea that such practice exists. To conclude the errors will go to stdout


it's common in pretty much all of unix, although i think it's a matter of taste / style what to do in the case of git clone


@lmergen There are many Unix commands where errors go to stderr and 'normal' output go to stdout. I think the surprise here is that the no-error case output goes to stderr.


Looks like at least a few other people consider this odd behavior on the part of git that surprises them, although I guess it is now fairly well known and documented:


thanks to @lmergen now I know why I couldn't grep the output of lein deps :tree...although now I need an alias for this mouthful lein deps :tree 2>&1 >/dev/null | grep 馃槢


lein-grep-tree 馃槃


@joelsanchez On my MacOS machine, I can do lein deps :tree | grep foo and get the filtered output. Your system doesn't?


@andy.fingerhut I'm on Linux, that might be it


My Ubuntu 18.04 VM also works without the extra piping trickery.


I think it is the git commands specifically that have the unusual behavior of sending progress output to stderr


I've done grep on tree before too, Linux. Something is wonky.


Fun fact, --help is supposed to go to stderr.