This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-16
Channels
- # announcements (2)
- # architecture (3)
- # beginners (72)
- # cider (15)
- # cljs-dev (27)
- # clojure (85)
- # clojure-berlin (3)
- # clojure-dev (4)
- # clojure-europe (7)
- # clojure-italy (7)
- # clojure-nl (6)
- # clojure-uk (17)
- # clojurescript (63)
- # clojutre (10)
- # core-async (10)
- # cursive (10)
- # datomic (34)
- # events (4)
- # fulcro (3)
- # funcool (8)
- # incanter (1)
- # jackdaw (1)
- # jobs-discuss (6)
- # joker (4)
- # kaocha (7)
- # leiningen (8)
- # nrepl (6)
- # off-topic (11)
- # reagent (8)
- # shadow-cljs (119)
- # spacemacs (11)
- # sql (11)
- # vim (30)
- # yada (2)
When a package is published on clojars, does it tend to just be the jar that gets uploaded? or the clojure source itself if it's available? I'm trying to be more considerate of old JRE users (those who still may be on java 8 ) when building a thing for distribution. If I swap between java versions locally, must i make sure to always switch to java 8 before uploading with something like lein ?
cool, so, if my library does not specify any "aot" in the lein project.clj, its safe to assume lein isn't compiling anything for me at all when I deploy the lib, its just pushing the source as I'd hoped
It is pretty easy to check a .jar file, which is pretty much just a zip archive, using a command like unzip -v foo.jar
, either after downloading one, or before uploading one to Clojars, if you are curious what files are inside of it.
At least on Mac and Linux systems. On Windows you can probably rename the file to have .zip
suffix and double click on it to see the contents, and dozens of other ways.
> It's "OK" to do AOT on everything as the last step when building an uberjar can it have a drawback, even in the context of uberjars? (not sure myself)
@vemv unless you're doing stuff which you shouldn't be doing like redefining vars at runtime I think it should be fine
thanks! yes, I haven't had a bad experience with it (web deployment) so far, but I fear I could hit an obscure issue someday.
Hello, are you aware of any good guides on the design of Clojure compiler? The structure of the projects, key components, getting around, algorithms used, this kind of stuff. Much appreciated, thanks.
Unfortunately not. I'm sure you are aware, that the source code is available on Github? Analyzing it could bring you further.
I had to think about your question when watching this video from Rich Hickey. I hope it helps https://youtu.be/wASCH_gPnDw?t=1381
Also, chapter 4 of SICP could help
https://github.com/clojure/clojure/blob/master/changes.md#user-content-11-java suggests it may be 1.9 -- perhaps someone else will chime in
That is the same source and latest info I know of. It was not until Clojure 1.10 was released that Clojure required Java 8 or later.
thank you very much both, i suspected such because there was no other mention of requirement until 1.10 but wasn't 100% sure 🙂
There are some even older versions of Clojure that mention minimum Java requirements, but you have to go back to Clojure 1.6 in the change log before you find that it requires Java 6 plus a special package, or Java 7.
there’s a java one here, for comparison: https://github.com/jhipster/prettier-java
zprint is working great for me! took a little hunting to find a nice way to make it work in intelliJ - if anyone is searching for how to transform selected text in place via a command that works with streams, then look for a plugin called pipeprofen
Hi. I'm struggling to find a convenient way of calling instrumentation for my tests. I mainly run them with lein test
. I've seen people around recommending loading (st/instrument)
in :injections
but this has never worked for me. I can see the namespace is loaded, but instrumentation never happens. It just doesn't.
The only way I can make it work is to sprinkle (st/instrument)
over all my test namespaces...
Does anyone have an instrument config that actually works with :injections
? Or some alternative way of setting this up? Thanks
https://github.com/jeaye/orchestra offers enabling instrumentation globablly https://github.com/borkdude/respeced seems more fine-grained. Personally I have reservations about the whole instrumentation approach, which is why I authored https://github.com/nedap/speced.def/ . It's been a success where I work.
Yep, I understand orchestra offers that. My point is where do people call instrument
.
I'd like to be able to call it once, and have all my test runs instrumented.
I've only been able to do this by calling instrument in every test namespace.
How about https://github.com/circleci/circleci.test/tree/c80c4c8300d2839b3f81597f6db9c32fe8e53859#global-fixtures ?
Its example mentions (stest/instrument)
🙂
Ha! But that is using circleci's test-runner... I have it as a plan B, but ideally I'd find a solution using vanilla clojure.test.
Yeah, I also have ci.test only "on the radar" in case someday I really need it. Seems well crafted anyway
1. https://github.com/camsaul/methodical via library
2. via custom hierarchy hack:
(defmulti multi-type (fn [a b]
[(type a) (type b)])
:hierarchy (atom {:ancestors (constantly #{:default})}))
(defmethod multi-type [Number :default] [_ _]
[Number :default])
(defmethod multi-type [:default Number] [_ _]
[:default Number])
(multi-type 1 "a") ; => [java.lang.Number :default]
(multi-type "a" 1) ; => [:default java.lang.Number]
(multi-type 1 1)
; Syntax error (IllegalArgumentException) compiling at (editor_extensions.clj:51:1).
; Multiple methods in multimethod 'multi-type' match dispatch value: [java.lang.Long java.lang.Long] -> [:default java.lang.Number] and [java.lang.Number :default], and neither is preferred
this is a hack because it uses hierarchy implementation and usage details and there is no promise it will work that way forever
(doc isa?)
-------------------------
clojure.core/isa?
([child parent] [h child parent])
Returns true if (= child parent), or child is directly or indirectly derived from
parent, either via a Java type inheritance relationship or a
relationship established via derive. h must be a hierarchy obtained
from make-hierarchy, if not supplied defaults to the global
hierarchy
derive
, which also uses hierarchy, states the same:
clojure.core/derive
([tag parent] [h tag parent])
Establishes a parent/child relationship between parent and
tag. Parent must be a namespace-qualified symbol or keyword and
child can be either a namespace-qualified symbol or keyword or a
class. h must be a hierarchy obtained from make-hierarchy, if not
supplied defaults to, and modifies, the global hierarchy.
so all hierarchy-related functions imply that hierarchy's shape is implementation details
right, how about this
(defmulti multi-type (fn [& args] (mapv type args)))
(defmethod multi-type [Number Object] [_ _]
[Number :default])
(defmethod multi-type [Object Number] [_ _]
[:default Number])
(multi-type 1 "a") ; => [java.lang.Number :default]
(multi-type "a" 1) ; => [:default java.lang.Number]
(multi-type 1 1)
; Syntax error (IllegalArgumentException) compiling at (editor_extensions.clj:51:1).
; Multiple methods in multimethod 'multi-type' match dispatch value: [java.lang.Long java.lang.Long] -> [:default java.lang.Number] and [java.lang.Number :default], and neither is preferred
what I meant by "feature" is that isa?
clearly is meant to support vectors like this, although the docstring doesn't mention it. That would be worth creating a ticket for I think.
I think he meant that building a custom hierarchy like this (atom {:ancestors (constantly #{:default})})
and abusing invoke on its vals is a hack
@alexmiller should the behavior of isa?
on vectors be documented? I can make a ticket and suggest a patch.
fwiw It's documented on the multimethods page on http://clojure.org @plexus > isa? works with vectors by calling isa? on their corresponding elements:
seems reasonable to doc that in isa?
too
Hey guys, I am trying to solve a Blocking I/O problem with ETL tool I am building. I posted my problem in reddit. https://www.reddit.com/r/Clojure/comments/d52c4l/blocking_io_in_clojure/
I hope someone could help me out
Is there a clojure reader that gives me the AST with location information of the tokens?
@finn.volkel including stuff like comments?
@finn.volkel SourceLoggingPushbackReader will give you all the location information of the tokens but they will be forms, (like (defn foo [a b] (+ a b))
, not the AST. Not sure if that is helpful for you.
IIRC even tools.analyzer won't give you location info for things that cannot have metadata, e.g. keywords, strings, and comments are not represented at all. It does have location information for all lists, vectors, sets, maps, and symbols, which can have metadata, and that metadata contains line/column info.
https://github.com/xsc/rewrite-clj is a library that enables reading Clojure code and data in a way that preserves whitespace and comments, yet make changes to it after reading it, so that it can be printed in a way that is textually as close as you want to what you read. Different kinds of use cases for that than what you want, perhaps.
Hi there! I would like to get a remote position as a Clojure developer. Would someone like to give me some hints?
#jobs-discuss would be a good place for that conversation @davd33
Thank you @seancorfield
Hi! I have a luminus project for which I’m trying to make an uberjar. The jar builds with one warning:
WARNING: var: clojure.string/replace-with is not public at line 327 target/cljsbuild/public/js/cuerdas/core.cljc
But it doesn’t run:
java -jar nb-agent-0.1.0-SNAPSHOT.jar
Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/Var
Any idea what that might be about or how to investigate it?sounds like nb-agent does not include compiled Clojure itself (as you'd expect in an uberjar)
@peterd when you make an uberjar, lein creates two jars, the one with your project itself, and the uberjar whiich includes that plus all deps
usually by default the one you want has standalone
in the name
it makes both because the one for your project alone is considered a pre-requisite for the uberjar, but this is a common tripping point
that sounds like a correct analysis to me
Yup! My luminus project renames the jars, and I didn’t think to look at the other one! Thanks!
Is there a way to use spec
on a map without mandating that the kw and spec have the same name? Like {:sponsor value-conforming-to-:person-spec}
?
@dchristianbell If you're working with unqualified keys, probably the simplest workaround would be an alias spec:
(s/def ::person-spec ,,, whatever ,,,)
(s/def :person/sponsor ::person-spec)
(s/def ::sponsor-map (s/keys :req-un [:person/sponsor ,,,]))
That key will be :sponsor
but the spec will be :person/sponsor
which is aliased to ::person-spec
.
Okay, great, thank you.