This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-30
Channels
- # announcements (2)
- # avi (12)
- # aws (6)
- # beginners (49)
- # boot (140)
- # cider (2)
- # cljs-dev (5)
- # cljsrn (9)
- # clojure (149)
- # clojure-czech (6)
- # clojure-miami (1)
- # clojure-nl (2)
- # clojure-russia (19)
- # clojure-ukraine (1)
- # clojurescript (34)
- # conf-proposals (36)
- # core-async (2)
- # cursive (11)
- # emacs (2)
- # funcool (23)
- # hoplon (2)
- # incanter (4)
- # jobs (1)
- # ldnclj (19)
- # om (47)
- # onyx (5)
- # proton (12)
- # re-frame (20)
- # ring-swagger (17)
- # testing (1)
@shriphani: can you say more about the error you got with eastwood?
ah actually it was bikeshed not eastwood: and the gist is: Checking for arguments colliding with clojure.core functions. Subprocess failed
@shriphani: there is an issue on github of a similar issue: https://github.com/dakrone/lein-bikeshed/issues/12 it sounds as though it is finding a collision, but failing to report it. perhaps you can comment on that issue?
I'm writing a macro and I receive it's arguments as [& args]. In the context of compiling to clojurescript, those args are a list. But in context of compiling to clojure, they are ArraySeq. I'm wondering what's the difference, what's ArraySeq and what's the best way to check for it?
@hans: well, I'm changing someone's library and to check it's a function body it does (and (list? body) (vector? (first body))
. I wonder if I can break anything by changing list?
to seq?
well, it's a bit more complicated... https://github.com/tonsky/rum/blob/gh-pages/src/rum/core.clj#L9 if you're interested
is there a quick way to get a utc timestamp in clojure, ie. without loading clj-time and so on?
I think that you need to take the Java path for this. As far as I know there are no date primitive in CLJ (defn now [] (new java.util.Date))
depending on your usecase for the utc timestamp, it might be better to import clj-time
and/or System/currentTimeMillis
which is way faster
depending on your need
when i try (defn now [] (java.util.Date.))
, and the call it, i’m getting a java is not defined
error. i suspect this is because i’m using figwheel and i’m really using clojurescript and not clojure?
ezmiller: clojurescript looks the same for the clojure part, but of course when using the underlying host platform (java for clojure, js for clojurescript, or event .NET for clojureCLR) it becomes different
oh and if all you need is a random string, UUID may be of interest
any pointers why lein run -m my.ns
fails with Cannot find anything to run for
though I have -main
defined?
And I'm assuming you defined -main
in my.ns
and not in some other namespace in the project? The error makes it sound like it's not in that namespace.
I can even run it from the repl:
user=> (rum.server-examples/-main)
[:div Static : [:span {:style {:color #FA8D97}} 15:00]]
nil
But:
> lein run -m rum.server_examples
Exception in thread "main" java.lang.Exception: Cannot find anything to run for: rum.server_examples
Hmm, it works? I would have expected the problem to be underscore vs hyphen there.
lein run -m rum.server-examples
not lein run -m rum.server_examples
yeah, I've completed with an underscore and didn't notice until posting command here...
#(...)
should be used only when it's short and obvious; I'm not sure multi-line would qualify.
Boot continuing to gain traction — thanks @seancorfield : https://seancorfield.github.io/blog/2016/01/29/rebooting-clojure/
Does anyone know if immutant or http-kit do concurrent request/response for regular http requests? Both docs appear to only mention concurrent stuff for websocket connections.
Application I'm working on has potentially long db IO time and I don't want the web server to block
Great, thanks for the quick response. I'm wondering if they do that automatically out of the box because I didn't see anything about configuring that. I'll go through the docs again
I'm leaning towards immutant but I don't plan on using any of the wildfly stuff
It looks like I can only use the web library though. Heard good stuff on aleph catacumba?
Im not familiar with manifold, Java lib?
This looks very cool
looked up immutant's docs, and I don't think they made it immediately clear how to make asynchronous requests, except maybe as-channel
yeah and most of that appeared geared towards websockets which maybe lead me off the sent
Does anyone know if it’s possible to specify JVM version specific :jvm-opts for lein? For example, specifying -XX:PermSize for Java 7 only so Java 8 doesn’t display warnings saying the options are being ignored?
@balduncle: I could be wrong, but I don't think there's anything in lein to help you there. I know it’s not ideal, but the only thing I can think of is programmatically generating the :jvm-opts
vector yourself in the project.clj based on the JVM version.
Yes you can build the JVM opts vector dynamically based on inspecting the Java version system property. We did that at World Singles back when we were rolling out Java 8.
@solicode, @seancorfield, Okay, that is what I thought as well. Thank you both.
Quick question - what do I have to implement on defrecord
to make private, record-specific methods on it? Or is there no way to do so?
@jaen: that’s not really the clojure way. You could make a protocol with only one impl, but that’s still slightly weird
Yeah, figured it would be weird. Just creating a component and wanted a private helper method, so I can close over the record arguments.
But if that's not really possible I'll just make a defn-
before the record and pass the fields I need I guess.
Adding a single-method protocol also has the downside of the method being public, which I would want to avoid; it's an implementation detail I want to factor out into a common place. Though on the other hand; what's the downside of having that method public if records are immutable I suppose.
@borkdude: not sure how that could work - this needs to be a defrecord
(using component) and the only way to close over defrecord
fields I know of is to add the method to it's body.
No, I agree; encapsulation is something created because of imperativeness and mutability none of which are pervasive in Clojure. I just feel kind of iffy exposing something like that for some reason.
We stopped writing private functions completely about a year ago at work. The only things we ever make private these days is some small piece of data that is used only within a namespace (either shorthand symbols for strings and keywords to avoid misspellings or atoms for the occasional bit of mutable singleton state).
And we're moving away from the latter. Slowly.
Does there happen to be a reference somewhere of the core Clojure protocols like those used by assoc, count, contains?, etc.?
@seancorfield: you probably have a pretty big codebase - doesn't this make things like "I created this function for local use in the namespace, but someone used it for something else and now I can't change it" happen more often if the intent is not stated? Or you document that in comments or something?
I still use defn-
but not as some sort of OO-style guarantee of private; more as of a description of my intent. Here’s my suggested API for a namespace and these over here marked defn-
are the bits behind the façade.
Huh, anyone ever encountered something similar?
java.lang.AbstractMethodError: Method thesis/backend/components/logic/users/Users.stop()Ljava/lang/Object; is abstract
(defrecord Users []
component/Lifecycle
(start [component]
component)
(start [component]
component)
protocols/CommandHandlerProvider
(-get-command-handlers [this]
{:users/create users-create-handler}))
I have a `(ns gps-tracker.handler
(:gen-class))` in my file… and a :main ^:skip-aot gps-tracker.handler
in my project.cljs...
but I am getting this warning: Warning: The Main-Class specified does not exist within the jar. It may not be executable as expected. A gen-class directive may be missing in the namespace which contains the main method.
@jaen: We find we get more reuse by not assuming a function should be private to a given namespace. Small, pure functions, that do some single, specific thing, often find new uses elsewhere. Then if we need to change the implementation for some of those uses, it’s reasonable to either just copy and modify the small function or add an optional keyword argument / new arity if that’s more appropriate. Of course if you copy’n’change a function, you have to pick a new name or refactor the more reused version into a different, more general namespace. We tend to do the latter.
I see. That makes sense, I suppose. I never had to work in a big project thus far, so was curious how this approach scales to more developers.
found the solution here: http://stackoverflow.com/questions/32554675/cant-run-uberjar-with-leiningen-2-5-2
Hi, there’s a java library I want to use in a clojure project. The project uses System.loadLibrary heavily and clojure versions > 1.6 don’t like it. Here’s the offending line: https://github.com/vinhkhuc/jcrfsuite/blob/4d417243802a08c3e0b7bdea9085d6bf3afc47e2/src/main/resources/crfsuite-0.12/native_loader/CrfSuiteNativeLoader.java#L28 Is there a quick solution to the problem? (i.e replace that line with something else like the clojure-specific loader). Would really like to not spend too much time rewriting that stuff.
If I have two lists of bools that I want to or
pair-wise, I can do this:
(map (fn [a b] (or a b)) [true false] [false true])
@grav Do you need to transpose the data though? How about something like this?
(map #(some true? %&) [true false] [false true])
@shriphani: curious- what gets reported when the library is loaded?
@thomas: the ^:skip-aot is keeping the namespace from being compiled.
@thomas: nm, didn't see the next comment
@jonahbenton: sorry was afk - just one sec