Fork me on GitHub
#beginners
<
2018-04-14
>
matan13:04:56

Any advice for quickly figuring the culprit dependency? this is when upgrading the project to clojure 1.9: > WARNING: any? already refers to: #'clojure.core/any? in namespace: vertigo.core, being replaced by: #'vertigo.core/any?

soulflyer13:04:52

@matan if its a leiningen project lein deps :tree might help

Alex Miller (Clojure team)13:04:22

sounds like the culprit is vertigo (https://github.com/ztellman/vertigo) and you can find the path to it with lein deps :why vertigo

Alex Miller (Clojure team)13:04:51

however, this is just a warning - it’s just saying that core now has an any? function and in vertigo.core, an any? function is being declared which will shadow the clojure.core one. That’s generally not an issue and shouldn’t cause any problems. The warning can be “fixed” in vertigo by using (:refer-clojure :exclude [any?]) to the namespace declaration

Alex Miller (Clojure team)13:04:07

but it looks like vertigo is archived

matan14:04:43

Ah, thanks!

matan14:04:14

@alexmiller my concern has been the scope in which vertigo's any? would shadow clojure's any?

matan14:04:47

I assume that scope would be the library that uses vertigo among my dependencies

matan14:04:04

thanks for adding those convenience functions in 1.9!

matan14:04:19

some of them were sure missing

joelsanchez14:04:24

the shadowing only happens in the namespace that declares any?

Alex Miller (Clojure team)14:04:28

shouldn’t be an issue. any code that was requiring that namespace would have been referring to the vertigo any? and still will

matan14:04:21

:thumbsup:

matan14:04:01

(totally unrelated) can we destructure (e.g. a vector) outside a let or defn form?

mfikes15:04:48

@matan As you would expect (like defn) it works for anonymous functions.

((fn [[x y]] [y x]) [1 2])

mfikes15:04:05

There is also clojure.core/destructure

matan15:04:46

So say I wish to pass arguments to a function, directly drawing them from within a vector, I'd have to explicitly use destructure or a let form in my code?

Alex Miller (Clojure team)15:04:10

Usually when people want to do this they write a macro that produces a let, fn, etc

matan15:04:08

:thumbsup:

Nikos17:04:26

Do you people have some sound advice on IDEs? I've been using emacs+cider for the last two months to learn Clojure, but I haven't acquired a taste for it, so I'm shopping for a new IDE/editor. Primarily, I want to use Clojure/CLJS for web development. I really like Light Table, but it looks like the project is pretty much dead now, and I'm not sure it's worth investing time into learning a stagnant tool like that. Nightcode is cool, but I'd prefer to have an IDE with a more sleek user interface, plus it seemed a little buggy too on the first try. So I'm pondering going with Atom with Proto REPL - I just don't know how well it works with all the peculiarities of Clojure and Clojurescript development. Thoughts?

grierson17:04:03

@nikoszp But I moved from Atom to Cursive. https://cursive-ide.com/

Nikos17:04:34

Thanks! How come?

grierson17:04:05

It just had everything I needed built-in. Parinfer, Rainbow parens, and custom key mappings with delayed presses.

grierson17:04:15

I could still happily use Atom with the setup above though. Not a huge difference between the two.

Nikos17:04:30

That's very useful, thanks!

lispyclouds17:04:53

@nikoszp I prefer using IntelliJ with the superb cursive plugin. Very nice and easy setup and for me the only thing that works perfectly even with the java internals of Clojure.

lispyclouds17:04:12

And not to mention intellij’s great code analysis and it helped out in using java libs in my clojure code which i often have to do

Nikos17:04:01

That's two votes for Cursive then. My only qualm is that the license is only free for "non-commercial licence for open-source work, personal hacking, and student work" as the site puts it.

grierson17:04:30

Which I think is fare. The developers need to make money somehow. But if that’s a real concern then the Atom setup above is just as good.

athomasoriginal17:04:47

I use Atom and protorepl and I am very happy with it.

athomasoriginal17:04:40

A lot of forward thinking clojure tools are being developed for Atom first, so there is that. For example, parinfer. Yes, these will be released on other editors in the future, but in the now, they work best on Atom

gklijs17:04:00

It's not that expensive, and @cfleming is often quick with fixes and feature requests.

Nikos17:04:49

That's a fair point. Splurging on it might even add an additional incentive to learn it inside out 😄

sveri17:04:38

one more for cursive, it's awesome

Nikos17:04:20

Alright, thanks for the input peeps. I'll definitely give Cursive a try!

matan17:04:19

@rahul080327 What does the "cursive plugin" add that IntelliJ doesn't have builtin for clojure?

lispyclouds17:04:46

@matan IntelliJ by itself doesn’t support clojure. Needs Cursive to support it. Like the Rust plugin to supoort rust.

matan17:04:37

Got it :thumbsup:

matan17:04:26

How would you say does it add up v.s. its $199 per seat price-tag?

matan17:04:53

BTW does that price cover for the IntelliJ license as well?

adc1717:04:16

I’m reading through clojure/tools/cli.clj and I found the function compile-option-specs. It looks like this:

(defn- compile-option-specs
  [option-specs]
  {:post [(every? (comp identity :id) %)
          (distinct?* (map :id (filter :default %)))
          (distinct?* (remove nil? (map :short-opt %)))
          (distinct?* (remove nil? (map :long-opt %)))]}
  (map (fn [spec]
         (-> (if (map? spec)
               (select-spec-keys spec)
               (compile-spec spec))
             (wrap-val :validate-fn)
             (wrap-val :validate-msg)))
       option-specs))
My question: what is the {:post [...]} map doing? It looks to me like the function would just return (map (fn [spec] ... ) option-specs) and ignore {:post ... } The docs say “An assertion error is thrown if any :id values are unset, or if there exist any duplicate :id, :short-opt, or :long-opt values.” So I assume the {:post} map is something to do with that. But how can it be used to throw an error?

sundarj17:04:55

the :post vector is for specifying postconditions (conditions on the return value of a function)

adc1717:04:19

thank you

sundarj18:04:06

no prob 🙂

sveri17:04:15

@matan IntelliJ license is extra, but there is a community version which is sufficient for cursive. If I was using clojure professionally I'd pay the price for cursive. As its only pet projects / open source stuff for me now, I can use the free version.

sveri17:04:41

If you have public open source projects you can also apply for a open source license @jetbrains.

matan17:04:10

> If you have public open source projects you can also apply for a open source license @jetbrains. that's only for the open source projects I assume, you won't get a free pass for your commercial ones just because of your open source ones I assume

matan18:04:57

Does Cursive put you on the crashing form when your program crashes?

matan18:04:17

Or you still have to read exception traces and navigate to the source line yourself, then guess which form crashed when the line has many forms?