This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-03
Channels
- # aleph (1)
- # beginners (42)
- # boot (34)
- # cider (157)
- # cljs-dev (12)
- # cljsrn (3)
- # clojure (165)
- # clojure-conj (1)
- # clojure-india (1)
- # clojure-italy (6)
- # clojure-russia (20)
- # clojure-spec (27)
- # clojure-uk (173)
- # clojurescript (116)
- # cursive (30)
- # datomic (87)
- # devcards (1)
- # docs (9)
- # emacs (2)
- # ethereum (2)
- # events (2)
- # fulcro (60)
- # graphql (10)
- # hoplon (2)
- # jobs-rus (6)
- # keechma (1)
- # lein-figwheel (9)
- # leiningen (36)
- # luminus (2)
- # mount (3)
- # off-topic (16)
- # om (14)
- # onyx (12)
- # pedestal (19)
- # portkey (107)
- # re-frame (9)
- # reagent (5)
- # ring (26)
- # shadow-cljs (149)
- # spacemacs (3)
- # sql (6)
argh. why is my mixed java/clj trying to first compile clj that is dependent on the java classes? even if I run lein javac, it tries to compile clj
often the simplest thing is to never compile your clj - to just put sources in your jar since you can't run clojure without the compiler anyway
okay @noisesmith - how do I tell leiningen not compile my clj?
by not having an :aot key in your project.clj
I don't, I only have it in uberjar profile. but I don't know, I feel this should be very simple. my java doesn't refer to any clj classes, it's strictly a library, yet leining wants to compile clj first, even on "lein javac"
it shouldn't be compiling anything if you don't specify aot
there's gen-class but it shouldn't even get that far
do you have a prep task of some sort that needs to load your namespaces?
clojure doesn't have a "compile only" mode, so if anything needs to load your namespaces, the classes they use must exist
which could include prep tasks or things like lein check
or lein eastwood
the stack trace when it complains about the class not existing might be informative
not to me but: at myclj.core$eval27078.invoke(core.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6927) at clojure.lang.Compiler.eval(Compiler.java:6916) at clojure.lang.Compiler.load(Compiler.java:7379) at clojure.lang.RT.loadResourceScript(RT.java:372) at clojure.lang.RT.loadResourceScript(RT.java:363) at clojure.lang.RT.load(RT.java:453) at clojure.lang.RT.load(RT.java:419) at clojure.core$load$fn__5677.invoke(core.clj:5893) at clojure.core$load.invokeStatic(core.clj:5892) at clojure.core$load.doInvoke(core.clj:5876) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invokeStatic(core.clj:5697) at clojure.core$load_one.invoke(core.clj:5692) at clojure.core$load_lib$fn__5626.invoke(core.clj:5737) at clojure.core$load_lib.invokeStatic(core.clj:5736) at clojure.core$load_lib.doInvoke(core.clj:5717) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invokeStatic(core.clj:648) at clojure.core$load_libs.invokeStatic(core.clj:5774) at clojure.core$load_libs.doInvoke(core.clj:5758) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invokeStatic(core.clj:648) at clojure.core$require.invokeStatic(core.clj:5796) at clojure.core$require.doInvoke(core.clj:5796) at clojure.lang.RestFn.invoke(RestFn.java:436) at user$eval3$loading__5569__auto____4.invoke(user.clj:1) at user$eval3.invokeStatic(user.clj:1) at user$eval3.invoke(user.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6927)
why is it loading your user.clj ?
I mean, I can guess why lein would do that, but I am now suspicious about what user.clj is doing
The Clojure runtime always loads user.clj on initialization
Worth mentioning that is essentially "untrue" with Boot (Clojure attempts to load user.clj
but won't find it anywhere useful).
oh thought I didn't have user.clj but I do. this is from a Luminus template.. it's mounting the repl-server.. and I guess together with https://github.com/technomancy/leiningen/issues/1245 causes the issue
yeah, I was unclear in my statement, I meant "your user.clj is the reason this is breaking"
yeah that's it thanks @noisesmith!
you can probably see how I deduced that from your stack trace 😄
🙂 sure. I didn't know about the whole user.clj or the problem with it & javac. thanks again!
well, the issue we were looking for was why your clj namespaces were being loaded before running javac, the fact that user.clj is mentioned at the "top" of the stack trace tells me that it is the culprit
https://dev.clojure.org/jira/browse/DZIP-6?focusedCommentId=47080#comment-47080 Found my issue haha.
Worth mentioning that is essentially "untrue" with Boot (Clojure attempts to load user.clj
but won't find it anywhere useful).
are there any recent libs for pulling stock data from google/yahoo ? I've found 3 libraries so far, they're all 7+ years old, and I'm pretty sure the API has changed since then
Never seen this book before. Someone mentioned it on Twitter: https://www.amazon.com/Quick-Clojure-Effective-Functional-Programming/dp/1484229517
@U04V15CAJ, I ordered a copy on Sunday evening. Should arrive some time today. I believe the author is @U051GTC61, but not certain
I was hoping to get some feedback from anyone else that had ordered the book before (I think it's a September '17 release), but no one replied to my comments a few days back.
I usually use (:keyword m)
if the map uses keywords as keys, and (get m thing)
for everything else
(assuming :my-key is a keyword in-line and not dynamically resolved in which case there’s a chance it can be nil or something non-callable)
What do you think about http://www.onyxplatform.org ? Just to know, do we have another alternatives? At that moment team needs mainly get data from one DB and put to others in different formats.
@kwladyka it’s readme mentiones http://storm.apache.org/ - the latter is proven, stable, but seems to be not such actively developed
AFAIK, Storm has been superseded by https://twitter.github.io/heron/ at Twitter
yeah, but writing ourself logic about what to do when something fail, write everywhere try and catch only to send errors to sentry (logger) etc. What i know onyx has this logic already implemented.
@kwladyka we've been using onyx to process events out of kafka for a while and had mostly happy times
This is one of the use-cases that confluent are pimping Kafka for. It would be pretty simple. You'd write a kafka-connect source connector to get your API data into kafka, maybe add some transformations to get it structured correctly for your target database, then a kafka-connect sink would load it into postgres
The multiple sinks requirement is solved quite elegantly with this approach. Just have separate processes consume the source topic and write out to their sink topic.
(let [m nil] (:key m))
=> nil
(let [m nil] (get m :key))
=> nil
(let [m nil] (m :key))
java.lang.NullPointerException
but majority of my usecases: ui templates, where I am 99% sure key is keyword, and m is 90% dynamic.
however I always use get
if I supply default value, because default value for (:key m default)
is "unusual", and (get m :key default)
feels more explicit to me
@mgrbyte damn that’s cool! haha always enjoy learning new things about Clojure, even after a bunch of years using it now…
on a somewhat separate point, perhaps a less known thing about Clojure is (nth [] 1 :not-found)
for that reason I don’t use the threading macros that much… sometimes it just becomes cumbersome to “thread it through the right place” lol
I mean: for just keys you can do both -> and ->>, and change macro "at will", say you started with (-> m :foo :bar), but then you need to add map, so you do (->> m :foo :bar (map inc))
@misha mmm yes… I would probably do this one like (into [] (comp (map :foo) (map :bar) (map inc)) [m])
… I abuse transducers a lot lol
but you can't switch from -> to ->> willy-nilly with (:foo default).
and for some reason, I think (get :key default) makes it more obvious that you "stuck with" ->
(let [m {:a {:b [0 1]}}] (->> m :a :b (map inc)))
=> (1 2)
(let [m {:a {:b [0 1]}}] (into [] (comp (map :foo) (map :bar) (map inc)) [m]))
java.lang.NullPointerException:
@raspasov also there is as->
, for when you need to thread through random argument positions
(as-> [1 2] $
(conj $ 3)
(map inc $))
=> (2 3 4)
@misha yes… 🙂 I do know that one, somehow I never made big use of it, maybe I should
perhaps because it’s a macro with “a lot of syntax” (relatively speaking) and my brain has generally become allergic to most syntax lol
yeah, way too much syntax, like specifying all of the function's arguments, who does that anyway!
how do we respond? https://medium.com/@dandisagrees/do-you-have-some-mainstream-projects-you-can-recommend-that-use-clojure-or-haskell-525d0681e290
hi, anyone knows if any attempts have ever been made to standardize lazy, callback-style asynchronous computations ?
@jiyinyiyong Clojure is a good example of a mainstream project written in Clojure 💥
@jiyinyiyong CircleCI's frontend is in cljs and on github
Trying to get my head around some macro basics. Is it possible for me to provide a symbol and have that resolved inside the macro so that I can do something like this? (my-macro my-vector) => #{:a :b :c}
(contrived example)
user=> (def my-vector [:a :b :c])
#'user/my-vector
user=> (defmacro my-macro [v] `(set ~v))
#'user/my-macro
user=> (my-macro my-vector)
#{:c :b :a}
@alexmiller Thanks, I think the macroexpand was confusing me
just always keep in mind that macros are code -> code functions
user=> (macroexpand '(my-macro my-vector))
(clojure.core/set my-vector)
so my-vector is not resolved “inside” the macro, rather it is part of the rewritten code emitted by the macro (and later evaluated)
anybody know how to use spec on a multi-arity function? such as (defn x ([] (x 1)) ([n] n))
? i can spec the one with args easily enough but not sure how to let :args
know it's cool if there is no argument.
(s/fdef x :args (s/? :n any?))
oh, no :n
(s/fdef x :args (s/? any?))
if you want better doc’ed conformed args, could also do:
(s/fdef x :args (s/cat :n (s/? any?)))
ah, ok, i was about to ask. i'm getting another issue i think because i have them in the wrong order (`s/cat in s/?`)
seems like would also possibly work?
(s/fdef x :args (s/? (s/cat :n any?)))
?
s/? is a little strange when used at top level
can you list a full repro?
no, s/or takes specs (including predicates as specs)
spec names like that are fine
don’t see anything wrong there
what do you evaluate when you get the error?
well that doesn’t do anything with spec
unless you’ve instrumented or are invoking spec inside connect!
looks to be dying here: https://github.com/clojure/spec.alpha/blob/master/src/main/clojure/clojure/spec/alpha.clj#L880
the parts you’ve shown look fine to me. what’s in ::client and ::client-spec?
::client is an inst?
spec and ::client-spec is a keys
spec. they work fine outside the function context.
have you re-invoked instrument after modifying the specs?
I absolutely love this clojure linting tool (can use it in conjunction with several editors): https://github.com/candid82/joker
@tdavis I built a subset in local repl and couldn’t reproduce
so either I’m missing something or your repl has out of date state
how odd. it definitely goes away if i get rid of the s/?
. i will restart repl and try again.
going offline…
If you have a reproduction case that looks different, please help out by pasting it on the jira! (can put code blocks like {code}
.... {code}
)
Does anyone have a few minutes to help me out with a HugSQL issue I'm experiencing?
I have a postgres table with 2 timestamptz fields that allows NULLs. On the hugsql side, one of the fields maps to basically {:timestamp_1 ...} while the other one maps to {:sub {:timestamp_2}} :timestamp_1 properly inserts a NULL, but :timestamp_2 throws a Parameter Mismatch exception (parameter data not found). I'm accessing timestamp_1 via :timestamp_1 in my .sql file, and timestamp_2 via :sub.timestamp_2 - so I don't believe it's a simple mistake on my part - as I'm doing this for other field types just fine
I have verified that the map being passed to the hugsql-generated function has the keys for both fields and their values are nil
...wrong window, sorry.
@jiyinyiyong Wire IM has server-side stuff written in Haskell https://github.com/wireapp/wire-server
is the correct way to reference a project value in maven to simply key off of project (e.g. (:jar-filename project)
)?
err, lein, not maven
@misha have you used as->
when you have mixed arities?
Anyone using Apache Spark, sparkling, and the Datastax Cassandra Driver all together ... looking to share insights/misery.
I’m going a bit nuts here - I want to generate a form using quasiquoting, which includes a non-namespaced quoted symbol. I’m trying to generate code which calls intern
.
`(intern 'clojure.core 'test true)
=> (clojure.core/intern (quote clojure.core) (quote clojure.core/test) true)
`(intern 'clojure.core 'test.foo true)
=> (clojure.core/intern (quote clojure.core) (quote test.foo) true)
`(intern 'clojure.core ~'test true)
=> (clojure.core/intern (quote clojure.core) test true)
`(intern 'clojure.core (quote test) true)
=> (clojure.core/intern (quote clojure.core) (quote clojure.core/test) true)