This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-14
Channels
- # beginners (53)
- # cider (10)
- # cljs-dev (23)
- # cljsrn (25)
- # clojure (68)
- # clojure-italy (4)
- # clojure-spec (25)
- # clojure-uk (7)
- # clojurebridge-ams (1)
- # clojurescript (10)
- # cursive (20)
- # datomic (21)
- # duct (4)
- # fulcro (1)
- # graphql (4)
- # hoplon (1)
- # java (7)
- # luminus (9)
- # off-topic (111)
- # om-next (2)
- # onyx (14)
- # re-frame (3)
- # reagent (9)
- # shadow-cljs (182)
- # test-check (32)
- # tools-deps (53)
- # uncomplicate (1)
- # vim (94)
- # yada (2)
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?
sounds like the culprit is vertigo (https://github.com/ztellman/vertigo) and you can find the path to it with lein deps :why vertigo
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
but it looks like vertigo is archived
@alexmiller my concern has been the scope in which vertigo's any?
would shadow clojure's any?
the shadowing only happens in the namespace that declares any?
shouldn’t be an issue. any code that was requiring that namespace would have been referring to the vertigo any? and still will
@matan As you would expect (like defn
) it works for anonymous functions.
((fn [[x y]] [y x]) [1 2])
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?
Usually when people want to do this they write a macro that produces a let, fn, etc
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?
@nikoszp This is a nice guide to set up Atom. https://medium.com/@jacekschae/slick-clojure-editor-setup-with-atom-a3c1b528b722
@nikoszp But I moved from Atom to Cursive. https://cursive-ide.com/
It just had everything I needed built-in. Parinfer, Rainbow parens, and custom key mappings with delayed presses.
I could still happily use Atom with the setup above though. Not a huge difference between the two.
@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.
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
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.
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.
I use Atom and protorepl and I am very happy with it.
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
It's not that expensive, and @cfleming is often quick with fixes and feature requests.
That's a fair point. Splurging on it might even add an additional incentive to learn it inside out 😄
@rahul080327 What does the "cursive plugin" add that IntelliJ doesn't have builtin for clojure?
@matan IntelliJ by itself doesn’t support clojure. Needs Cursive to support it. Like the Rust plugin to supoort rust.
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?the :post
vector is for specifying postconditions (conditions on the return value of a function)
@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.
If you have public open source projects you can also apply for a open source license @jetbrains.