workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
got it; thanks
2017-11-27T22:49:24.000107
Berry
clojurians
clojure
I'm trying to download a dependency, jai_core, from here <https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/javax/media/jai-core/1.1.3/>. I added the repository to my project.clj like this `:repositories [[["jboss-third-party" "<https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/>"]]]`. I still get an error message like this though `Could not find artifact javax.media:jai_core:jar:1.1.3 in jboss-third-party (<https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/>)`
2017-11-28T02:37:47.000044
Mark
clojurians
clojure
What am I doing wrong?
2017-11-28T02:37:53.000033
Mark
clojurians
clojure
You need to request `jai-core` not `jai_core`
2017-11-28T02:50:01.000299
Shira
clojurians
clojure
hm
2017-11-28T02:54:52.000322
Mark
clojurians
clojure
I can't find any uses of jai_core though, I'm thinking this is a transitive dependency
2017-11-28T02:55:53.000118
Mark
clojurians
clojure
<https://mvnrepository.com/artifact/javax.media/jai_core/1.1.3> ah, there's jai-core and jai_core :slightly_smiling_face:
2017-11-28T02:56:19.000112
Mark
clojurians
clojure
Thanks for the tip
2017-11-28T02:56:29.000084
Mark
clojurians
clojure
what's the cljs equiv of clojure.edn ?
2017-11-28T05:02:53.000078
Berry
clojurians
clojure
do I need a separate library, or is this part of clojure?
2017-11-28T05:03:04.000141
Berry
clojurians
clojure
it's transitively part of cljs
2017-11-28T05:04:19.000337
Kareen
clojurians
clojure
`cljs.tools.reader.edn`
2017-11-28T05:04:25.000299
Kareen
clojurians
clojure
or `clojure.tools.reader.edn`, as you prefer
2017-11-28T05:04:32.000126
Kareen
clojurians
clojure
``` #?(:cljs [cljs.tools.reader.edn :as edn] :clj [clojure.edn :as edn]) ``` is there a better way to write this, or do I need the conditional ? (this is for a cljc file)
2017-11-28T05:05:54.000102
Berry
clojurians
clojure
you can use `clojure.tools.reader.edn` in both clj and cljs
2017-11-28T05:12:22.000336
Kareen
clojurians
clojure
otherwise what you have is ok
2017-11-28T05:12:35.000049
Kareen
clojurians
clojure
yay for tools.reader!
2017-11-28T05:14:04.000399
Fe
clojurians
clojure
I couldn't figure out how to start clojure 1.9. from the command line (sans boot tools) using `java -cp` because of the additional dependency (now that `java -jar clojure.jar` is not sufficient anymore). Specifically - which version of spec is needed for clojure-1.9.0-rc2? - is `java -cp clojure.jar:spec.jar clojure.main` the recommended way to start this? - is this documented somewhere? This would be a good candidate for the release notes as it might catch users switching to 1.9 unaware
2017-11-28T07:04:03.000121
Fe
clojurians
clojure
hello, channel
2017-11-28T07:19:00.000303
Idella
clojurians
clojure
&gt; If you’ve spent years learning tricks to make your [multi-threaded] code work at all, let alone rapidly, with locks and semaphores and critical sections, you will be disgusted when you realize it was all for nothing. If there’s one lesson we’ve learned from 30+ years of concurrent programming, it is: just don’t share state. It’s like two drunkards trying to share a beer. It doesn’t matter if they’re good buddies. Sooner or later, they’re going to get into a fight. And the more drunkards you add to the table, the more they fight each other over the beer. The tragic majority of MT applications look like drunken bar fights. ~ <http://zguide.zeromq.org/page:all>
2017-11-28T07:33:21.000039
Nilda
clojurians
clojure
hello everyone, is there a function equivalent of haskells `partition :: (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a]) ` in clojure?
2017-11-28T07:58:30.000060
Amado
clojurians
clojure
<@Amado>: <https://clojuredocs.org/clojure.core/partition-by>
2017-11-28T07:59:41.000201
Nilda
clojurians
clojure
<@Amado> Not really, but `group-by` is close
2017-11-28T07:59:44.000291
Randee
clojurians
clojure
That's very different I think.
2017-11-28T08:00:09.000329
Randee
clojurians
clojure
Many programming languages (also e.g. Kotlin) output only 2 vector for `partition`
2017-11-28T08:00:38.000114
Randee
clojurians
clojure
Alright, my bad
2017-11-28T08:01:20.000496
Nilda
clojurians
clojure
<@Nilda>, im not sure if ive understood the docs right
2017-11-28T08:06:28.000293
Amado
clojurians
clojure
<@Fe> two options: 1- use the new `clj` script 2- the just released 1.9.0-RC2 has a standalone jar, it's documented in the readme
2017-11-28T08:06:33.000292
Kareen
clojurians
clojure
``` (partition-by even? [1 2 3 4 5 6 7 8]) ;=&gt; ((1) (2) (3) (4) (5) (6) (7) (8)) ```
2017-11-28T08:07:25.000475
Amado
clojurians
clojure
This will be documented on the Getting Started page on release but there are several answers. 1) use a build tool like lein, boot, maven, etc. If you include Clojure 1.9 as a dependency, it will also pull in its dependencies automatically (spec.alpha and core.specs.alpha). 2) use the new Clojure cli scripts doc’ed at <https://clojure.org/guides/deps_and_cli>. If you’re on a Mac this is as simple as `brew install clojure` then `clj`. 3) build a stand-alone jar from the Clojure git repo - git clone the repo and then follow the directions in the readme. 4) Download the jars for Clojure, spec.alpha, and core.specs.alpha and manually create the classpath. This is probably the most cumbersome
2017-11-28T08:07:30.000086
Sonny
clojurians
clojure
id like 2 lists as a result
2017-11-28T08:07:53.000456
Amado
clojurians
clojure
My suggestion is incorrect for what you have in mind, I misunderstood the purpose of partition in Haskell.
2017-11-28T08:07:59.000306
Nilda
clojurians
clojure
Give the `group-by` suggestion by <@Randee> a whirl, it’s more likely what you’re looking for.
2017-11-28T08:08:47.000489
Nilda
clojurians
clojure
found the solution, ended up with `(vals (group-by even? [1 2 3 4 5 6 7 8]))`
2017-11-28T08:09:30.000197
Amado
clojurians
clojure
group-by
2017-11-28T08:09:32.000309
Kareen
clojurians
clojure
yep
2017-11-28T08:09:35.000261
Kareen
clojurians
clojure
<@Amado> note that using vals is probably incorrect
2017-11-28T08:10:05.000486
Kareen
clojurians
clojure
group by returns an unordered map
2017-11-28T08:10:14.000250
Kareen
clojurians
clojure
no guaranteed that you'll get [truthy falsy] vs [falsy truthy]
2017-11-28T08:10:26.000046
Kareen
clojurians
clojure
+1 to `cloogle` with spec
2017-11-28T08:10:49.000097
Jutta
clojurians
clojure
hmm
2017-11-28T08:14:40.000475
Amado
clojurians
clojure
`(defn haskell-partition [f coll] (map (group-by f coll) [true false]))`
2017-11-28T08:33:21.000448
Cecilia
clojurians
clojure
(haskell-partition even? (range 10)) =&gt; ([0 2 4 6 8] [1 3 5 7 9])
2017-11-28T08:33:29.000377
Cecilia
clojurians
clojure
(threads do not support inline code blocks, which sucks, try to bear with me)
2017-11-28T08:33:45.000160
Cecilia
clojurians
clojure
and I’m not 100% certain if that is actually what that haskell function does but I think it gets close enough
2017-11-28T08:34:15.000106
Cecilia
clojurians
clojure
let me put my suggestion here, it’s now hidden inside a thread: ``` (defn haskell-partition [f coll] (map (group-by f coll) [true false])) (haskell-partition even? (range 10)) =&gt; ([0 2 4 6 8] [1 3 5 7 9]) ```
2017-11-28T08:36:32.000131
Cecilia
clojurians
clojure
this way order is guaranteed
2017-11-28T08:37:29.000573
Cecilia
clojurians
clojure
thank you!
2017-11-28T08:39:38.000605
Amado
clojurians
clojure
np
2017-11-28T08:39:43.000280
Cecilia
clojurians
clojure
it is not always obvious that you can use maps as functions :slightly_smiling_face:
2017-11-28T08:41:12.000070
Cecilia
clojurians
clojure
Hm the rc2 link on <https://clojure.org/community/downloads> is broken
2017-11-28T09:03:46.000035
Fe
clojurians
clojure
cc: <@Sonny>
2017-11-28T09:03:54.000615
Fe
clojurians
clojure
<@Kareen>, do you know if the standalone jar is published somewhere?
2017-11-28T09:05:23.000470
Fe
clojurians
clojure
no
2017-11-28T09:05:35.000370
Kareen
clojurians
clojure
it's just a local build
2017-11-28T09:05:43.000336
Kareen
clojurians
clojure
as the build profile names suggests
2017-11-28T09:05:49.000276
Kareen
clojurians
clojure
thanks for the reply! building the classpath manually is fine by me - looks like you can see the correct spec.alpha and core.spec.alpha versions here: <https://mvnrepository.com/artifact/org.clojure/clojure/1.9.0-RC1>
2017-11-28T09:08:36.000363
Fe
clojurians
clojure
Ah yeah, I need to update that page. This just changed as of yesterday.
2017-11-28T09:10:22.000408
Sonny
clojurians
clojure
Yep, but note that the reason for breaking these out is to allow them to change more quickly than Clojure so there won’t be one single version that is applicable necessarily
2017-11-28T09:12:01.000314
Sonny
clojurians
clojure
We have a weird issue where some go routines stop working after about 5hrs - any ideas what we can look at ?
2017-11-28T09:24:53.000174
Celina
clojurians
clojure
when I try to build the classpath manually I get `Could not locate clojure/spec/alpha__init.class or clojure/spec/alpha.clj on classpath`
2017-11-28T09:25:30.000331
Fe
clojurians
clojure
look for blocking IO inside `go` blocks
2017-11-28T09:25:31.000390
Kareen
clojurians
clojure
will that hold up all the go routines though ?
2017-11-28T09:25:55.000336
Celina
clojurians
clojure
blocking io is almost always the culprit
2017-11-28T09:25:55.000718
Weston
clojurians
clojure
<@Celina> go routines execute in a shared threadpool
2017-11-28T09:26:15.000295
Kareen
clojurians
clojure
if you block all the threads available in that threadpool, nothing will gets executed anymore
2017-11-28T09:26:31.000590
Kareen
clojurians
clojure
it's just 8 threads even so it's quite easy to break if you're not careful
2017-11-28T09:26:45.000647
Weston
clojurians
clojure
<@Fe> how are you bulding that cp?
2017-11-28T09:27:14.000197
Kareen
clojurians
clojure
thanks folks - off to debug
2017-11-28T09:27:35.000156
Celina
clojurians
clojure
<@Kareen>, I had a typo
2017-11-28T09:33:23.000481
Fe
clojurians
clojure
it works now - here's a simple script to download clojure manually: <https://gist.github.com/pesterhazy/afdfa47ac04d94ee16b5f2e8ddbb0bb1>
2017-11-28T09:33:39.000449
Fe
clojurians
clojure
don't do that
2017-11-28T09:34:40.000409
Kareen
clojurians
clojure
right, so the version in clojure's pom is essentially the minimal version of those extra deps
2017-11-28T09:34:56.000805
Fe
clojurians
clojure
use the new clj script instead
2017-11-28T09:35:15.000010
Kareen
clojurians
clojure
no
2017-11-28T09:35:21.000218
Fe
clojurians
clojure
why? it basically does that for you
2017-11-28T09:35:33.000449
Kareen
clojurians
clojure
I understand, but this is simple and I know exactly what it does - it's the moral equivalent of the standalone jar in clojure 1.8
2017-11-28T09:36:37.000409
Fe
clojurians
clojure
clojure is just a jar, remember?
2017-11-28T09:37:08.000640
Fe
clojurians
clojure
so what?
2017-11-28T09:37:12.000726
Kareen
clojurians
clojure
(or three jars)
2017-11-28T09:37:13.000337
Fe
clojurians
clojure
meh
2017-11-28T09:37:17.000218
Kareen
clojurians
clojure
feels like NIH tbh
2017-11-28T09:37:24.000435
Kareen
clojurians
clojure
I don't see any point in reinventing something that has now an official impl
2017-11-28T09:37:42.000488
Kareen
clojurians
clojure
but you're free to do as you think best :)
2017-11-28T09:38:02.000082
Kareen
clojurians
clojure
all `clj` does is download your artifacts and build a cacheable classpath for you, nothing more than that or magical
2017-11-28T09:39:38.000707
Kareen
clojurians
clojure
`clj` is wonderful, but that doesn't mean that it's not useful to build a shell script to understand how it works
2017-11-28T09:40:57.000178
Fe
clojurians
clojure
I'm not saying it's not useful to build a simplified version of X to understand how it works, I'm saying if you need to use it, it's probably better to use X instead. in this case, your script will break when clojure adds a new dependency. `clj` would handle that automatically
2017-11-28T09:46:28.000396
Kareen
clojurians
clojure
it won't break so long as I don't update the clojure version :slightly_smiling_face:
2017-11-28T09:54:21.000536
Fe
clojurians
clojure
Hi, is `ex-info` json serializable?
2017-11-28T10:14:34.000564
Jacalyn
clojurians
clojure
<@Jacalyn> ex-info can contain any java objects, so it depends on the contents
2017-11-28T10:15:18.000385
Fe
clojurians
clojure
This doesn't seem to work: ``` (try (throw (ex-info "testss" {:a 3})) (catch Exception e (clojure.data.json/write-str (Throwable-&gt;map e)))) =&gt; Exception Don't know how to write JSON of class java.lang.Class clojure.data.json/write-generic (json.clj:385) ```
2017-11-28T10:15:28.000532
Jacalyn
clojurians
clojure
What about that case though ^
2017-11-28T10:15:33.000609
Jacalyn
clojurians
clojure
get it using ex-data?
2017-11-28T10:15:51.000011
Fe
clojurians
clojure
Yeah, if I did that, I would lose the Message.
2017-11-28T10:16:07.000481
Jacalyn
clojurians
clojure
which in this case above is "testss".
2017-11-28T10:16:22.000397
Jacalyn
clojurians
clojure
it says right in the error message what the problem is
2017-11-28T10:26:53.000684
Tai
clojurians
clojure
you’re trying to serialize an object of the class java.lang.Class, and your json writer doesn’t know how to do that
2017-11-28T10:27:15.000480
Tai
clojurians
clojure
Ah thank you, it's a macro so I must evaluate it? ``` (try (throw (ex-info "testss" {:a 3})) (catch Exception e `(json/write-str (Throwable-&gt;map ~e)))) ```
2017-11-28T10:28:08.000056
Jacalyn
clojurians
clojure
no, being a macro doesn’t have anything to do with it. `(Throwable-&gt;map e)` produces something that has a java.lang.Class object inside it.
2017-11-28T10:29:12.000427
Tai
clojurians
clojure
Ok but then how can you json serialize a generic ex-info?
2017-11-28T10:30:10.000599
Jacalyn