This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-26
Channels
- # announcements (6)
- # beginners (328)
- # boot (2)
- # cider (72)
- # clara (6)
- # cljdoc (4)
- # cljsrn (5)
- # clojure (78)
- # clojure-europe (3)
- # clojure-italy (22)
- # clojure-nl (4)
- # clojure-spec (3)
- # clojure-uk (114)
- # clojurescript (22)
- # clojurex (54)
- # copenhagen-clojurians (1)
- # core-async (20)
- # cursive (8)
- # data-science (1)
- # datomic (22)
- # duct (11)
- # emacs (32)
- # events (1)
- # figwheel (2)
- # fulcro (18)
- # graalvm (53)
- # graphql (39)
- # luminus (6)
- # nrepl (6)
- # off-topic (53)
- # om (1)
- # re-frame (8)
- # reagent (19)
- # reitit (3)
- # shadow-cljs (28)
- # spacemacs (10)
- # sql (37)
- # tools-deps (33)
- # vim (9)
- # xtdb (6)
Leiningen was created first, and served the purposes of many many developers. Some developers decided they wanted something significantly different. I haven't used boot myself, but my impression is that the build "scripts" you create with it are just Clojure code, leveraging useful libraries provided by boot. Many developers decided they liked that style of tool better, and used it instead of Leiningen.
The development of boot did not cause everyone to switch to it from Leiningen, and some fraction of people use neither Leiningen nor boot.
The "What tools do you use" question on the 2019 State of Clojure survey shows what the responders use: https://www.surveymonkey.com/results/SM-S9JVNXNQV/ (Question 17)
(xml/parse-str "<book><!-- i can see you--></book>")
produces #xml/element{:tag :book}
but i want to keep the comment. what should i do?
i saw https://stackoverflow.com/questions/30081209/how-to-preserve-comments-when-parsing-xml-with-clojure but maybe things have changed?
You can tell it which infoset types to keep while parsing. There’s a default set, but you can override it.
Example here that keeps the comments (using latest data.xml): https://github.com/clojure/tools.deps.alpha/blob/master/src/main/clojure/clojure/tools/deps/alpha/gen/pom.clj#L122
@alexmiller you are super helpful, thank you very much
I’m trying to call this (GLFW/glfwCreateWindow (int 300) (int 300) title nil nil)
but I get a reflection warning call to static method glfwCreateWindow on org.lwjgl.glfw.GLFW can't be resolved (argument types: int, int, java.lang.CharSequence, unknown, unknown)
the last 2 arguments really have to be nil
what is the signature(s) of that method @stathissideris? (include all if there are different types for the same arity)
public static long glfwCreateWindow(int width,
int height,
java.nio.ByteBuffer title,
long monitor,
long share)
public static long glfwCreateWindow(int width,
int height,
java.lang.CharSequence title,
long monitor,
long share)
ooooooh I just realized that the java example I’m translating uses NULL
instead of null
, probably a static member of some class. Thanks, let me investigate
it seems to be that 🙂
is Clojure pre-installed on MAC OS ?
but if you have brew, it's just a "brew install clojure" away
Yup. That's my plan
They took away telnet they wouldn’t want something as awesome as Clojure in there it might give people ideas
I am just getting into Clojure, setting up my dev env ...
i just started with clojure too, found this to be really helpful https://www.braveclojure.com/clojure-for-the-brave-and-true/
Dog, how do you feel today. I know it's been a bad day
Good here.
Guess you didn't hear the news
i looked up google news, nothing extremely bad, just the regular varity of depressing lol
Is there a good tutorial or article or whatever about functional patterns of interop with java?
I can think of a few from StuartSierra that apply don't wrap side effects in laziness https://stuartsierra.com/2015/08/25/clojure-donts-lazy-effects and the one about "it isn't mutation if the consequences don't escape scope"
maybe that was someone else's
@markx my tl;dr version is don't build "pure" facades over impure things unless the scope of the thing ends with the return of your function
but there are plenty of things in java (that one would use via interop) that are immutable / functional
Thanks I’ll read it later. My problem is that I found everything I want to do requires some java interop, which is very sad. (I wish Clojure didn’t encourage java interop) Recently I’ve been using Jline and I can’t find a comfortable pattern to integrate it to my clojure code. I basically create an object from the class and store it into an atom, and then all functions refer to that atom. I feel if I have to do it this way why don’t I just write java.
why an atom?
if you mutate the object, the atom isn't safe
swap! etc. guarantee to retry on conflict, you can't retry operations on a stateful mutable thing
you could use an agent (operations are guaranteed not to overlap, no retries)
well I don’t use swap! to call methods of that object. I just use atom to keep a reference.
you could only use the object in one thread, and not create a global handle to it
then you need some sort of locking scheme to prevent interleaved partial writes
or make a worker thread with the sole job of writing, and a queue that pulls requests from other threads
it's still not safe to simply put the connection in a global without other infrastructure
stateful objects shouldn't be global, and if they are global, they need some other infrastructure in order to be used correctly
and I was overgeneralizing - there's such thing as thread safe mutable objects - it's just not the norm (and you usually need to fill in some details about what to do in conflicts in surrounding code, or understand the possibility of deadlocks...)
anyway, atoms are meant for safely updating contents that are immutable, so are a mismatch for holding a mutable object
(not using swap! or swap-vals! or compare-and-set is a sign an atom is the wrong container to me)
libraries like stuartsierra/component, and integrant, etc. are designed for managing stateful objects (doing initialization as you spin up your system, and shutting them down cleanly when done, handing references to the parts of the system that need to use them without relying on globals)
@markx "Functional programming with immutable values is wonderful, but sooner or later every program has to deal with mutable, stateful, imperative tasks." https://www.youtube.com/watch?v=13cmHf_kt-Q
@mikerod Regarding one of your comments about the cljol library I mentioned in the announcements channel recently, there is certainly more that could be done with it to programmatically analyze a collection of Java objects, and in fact the JOL library itself already contains some code to print summary statistics of a collection of objects in a few different ways. The graph drawing parts of cljol are nice for small to medium sized things, but quickly become too much for a person to make use of.
@andy.fingerhut yeah, it makes sense. It looks like something interesting to look at though. I could see it being valuable to be able to navigate over these things
Definitely. I have already written some code that does sanity checks on the Java object graphs obtained using the JOL library. For example, if a GC occurs in the middle of walking a structure, the addresses of objects can change, and memory addresses is the way that JOL remembers which object is which while doing the walks, so in those cases you can end up with much less useful results.
How does this tool compare to https://github.com/clojure-goes-fast/clj-memory-meter?
I do not know yet. Thanks for pointing it out. I may be able to answer that question later, but at first look, the graphs that clj-memory-meter are ASCII art only, but it definitely seems better at giving total stats for a single object or all objects reachable from there within a REPL.
As it is now, the code looks for such inconsistencies, and if it finds one, runs (System/gc) and tries walking the structure again, up to 4 times.
The Clojure data structures created as an intermediate step would be straightforward to do other kinds of analysis on, other than drawing graphs.
has anyone been having issues with the https://repo1.maven.org/maven2/org/clojure maven repository? Or perhaps anyone that uses Travis having any issues running lein deps?