workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
I'd just use Java for that.
2017-10-28T21:39:36.000060
Bibi
clojurians
clojure
Yea, that makes sense.
2017-10-28T21:40:15.000016
Araceli
clojurians
clojure
yeah - particularly because of the issues with boxed numerics, it's just easier to write a bit of java once you know which code has to be that fast
2017-10-28T21:40:34.000009
Margaret
clojurians
clojure
<@Margaret> True. Although, it seems like (from what I can tell from <http://insideclojure.org/2014/12/15/warn-on-boxed/>), unboxed math is possible in Clojure.
2017-10-28T21:41:45.000048
Araceli
clojurians
clojure
it's possible, it's a pain to get right
2017-10-28T21:43:17.000022
Margaret
clojurians
clojure
<@Bibi> <@Jonas> <@Margaret> Well, thank you for your responses. I think I should go reconsider what I am doing and why, as it sounds like I may be entering "when all you have is a hammer" territory.
2017-10-28T21:43:23.000001
Araceli
clojurians
clojure
I think one of the nice things for clojure is that if you do want to use some of the great work in the jvm ecosystem, you can use it as needed
2017-10-28T21:44:06.000100
Jonas
clojurians
clojure
So, I just went to look at the Benchmarks Game to see how they micro-optimized algorithms in Clojure. Unfortunately, it looks like, at some point recently, they removed Clojure from their languages list.
2017-10-28T21:47:42.000084
Araceli
clojurians
clojure
Wat?
2017-10-28T22:54:01.000049
Sonny
clojurians
clojure
Looks like it was removed from the web site on sept 20th, along with scala?
2017-10-28T23:10:09.000033
Sonny
clojurians
clojure
32-bit core is available <http://benchmarksgame.alioth.debian.org/u32/>
2017-10-28T23:32:05.000045
Lovie
clojurians
clojure
<@Lovie> Looks like that one's full of dead links, unfortunately. I can click into the language pages, but not the implementation source code pages. It just returns 404 Not Found.
2017-10-28T23:51:48.000046
Araceli
clojurians
clojure
2016 clojure removed? Guess we'll have to wait until 2032... "abandoned in 2002...restarted in 2004...continued from 2008...Everything has changed; several times." <https://benchmarksgame.alioth.debian.org/sometimes-people-just-make-up-stuff.html>
2017-10-29T02:24:42.000026
Lovie
clojurians
clojure
anyone know a handy way to detect circular dependencies in graphs?
2017-10-29T05:03:15.000064
Kristy
clojurians
clojure
I took a look at ubergraph and loom, no luck
2017-10-29T05:03:39.000001
Kristy
clojurians
clojure
<https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm>
2017-10-29T05:05:53.000045
Hedwig
clojurians
clojure
should be translated to clojure very quickly
2017-10-29T05:06:03.000024
Hedwig
clojurians
clojure
can eventually try out, thanks! meanwhile checking if I can steal something off `stuartsierra/component `
2017-10-29T05:06:45.000043
Kristy
clojurians
clojure
<https://github.com/stuartsierra/dependency/blob/master/src/com/stuartsierra/dependency.cljc#L89>
2017-10-29T05:11:43.000056
Kristy
clojurians
clojure
@vemv isn't <http://aysy.lu/loom/loom.alg.html#var-dag.3F> what you need ?
2017-10-29T05:28:20.000038
Rosia
clojurians
clojure
guess so! `(def has-circular-dependencies? (complement dag?))` ?
2017-10-29T05:48:35.000005
Kristy
clojurians
clojure
yes, a dag has no cycle by definition
2017-10-29T06:04:42.000022
Rosia
clojurians
clojure
this function won't give you the culprit however
2017-10-29T06:06:02.000024
Rosia
clojurians
clojure
Does anyone know how to add accents or diacritical marks to characters? As in add ¨ to a to make ä?
2017-10-29T06:08:06.000049
Jermaine
clojurians
clojure
Found that you can do "e\u0305".
2017-10-29T06:23:56.000080
Jermaine
clojurians
clojure
<https://github.com/funcool/clojure.jdbc> Comparing to *java.jdbc* I like clearer docs and simpler API, especially that there's a difference between connections/dbspecs and how transactions are implemented. Other advantages are pointed out in the FAQ: <http://funcool.github.io/clojure.jdbc/latest/#why-another-jdbc-wrapper>
2017-10-29T07:59:36.000001
Adele
clojurians
clojure
By chance I happened across this yesterday: <http://clj-me.cgrand.net/2013/03/18/tarjans-strongly-connected-components-algorithm/> It sounds like it's maybe not what you need, <@Kristy>, but FYI just in case it's useful to you.
2017-10-29T12:16:18.000067
Adelaida
clojurians
clojure
I'm not having much luck trying to write a pmap-like function that times-out after a specified number of milliseconds. I tried two implementations: one with futures and one with core.async. The more complicated futures one passes tests but doesn't stop processes when running in my project. The core.async one is even worse in that regard. I'm new to core.async. If you care to take a look, the code is here: <https://github.com/pdenno/utils4pmap/blob/master/src/pdenno/utils4pmap.clj> There are tests in utils4pmap_test.clj
2017-10-29T18:55:37.000110
Sherryl
clojurians
clojure
`(re-find #"[0-9]+(\.[0-9]*)?" "29482asdf")` this returns a vector [complete-match ... groups ... ] is there a way to have it just return the full-match, and not all the intermediate groups ? (I know that I can call first, but I'm trying to get an interface to re-find where it just returns compete string, instead of all groups)
2017-10-29T22:24:00.000119
Berry
clojurians
clojure
you can use non capturing groups, `(re-find #"[0-9]+(?:\.[0-9]*)?" "29482asdf")`
2017-10-29T22:32:46.000035
Jonas
clojurians
clojure
by adding the `?:` at the start of the group
2017-10-29T22:32:59.000031
Jonas
clojurians
clojure
<@Jonas>: that is much nicer than my current solution of: ``` (defn re-find0 [pat s] (let [ans (re-find pat s)] (if (vector? ans) (first ans) ans))) ```
2017-10-30T00:26:23.000076
Berry
clojurians
clojure
future-cancel is unreliable, if you want something to be cancellable you need to ensure it regularly calls some cancellable method (the list is relatively short) <https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html#cancel(boolean)>
2017-10-30T02:14:43.000032
Margaret
clojurians
clojure
<@Marla> <@Herminia> Around the time, you are visiting the meetup in prague on December, 6th, are you able to visit or speak on another meetup nearby?
2017-10-30T03:42:37.000168
Hermelinda
clojurians
clojure
How do you pass data from `clojure.test` fixtures to tests (e.g a db connection where you don't know the port at write time)?
2017-10-30T05:37:04.000278
Lesia
clojurians
clojure
how do I create a regex that only ma5ches +-*/ `[+-*/]` ==&gt; invalid character range
2017-10-30T06:57:50.000199
Berry
clojurians
clojure
you need to escape the -
2017-10-30T06:58:57.000213
Weston
clojurians
clojure
oh, it's looking for a range of '+' to "*/" ?
2017-10-30T06:59:29.000454
Berry
clojurians
clojure
I can see that being an invalid range
2017-10-30T06:59:38.000288
Berry
clojurians
clojure
`#"[+\-*/]"` worked; thanks
2017-10-30T07:00:10.000276
Berry
clojurians
clojure
Guys Hi, Is there a problem with clojars? I can not download any dependencies, getting a protol version error?
2017-10-30T07:54:53.000061
Dane
clojurians
clojure
<@Berry>, I think alternatively you can move the dash to the end of the character group
2017-10-30T08:08:25.000039
Fe
clojurians
clojure
<@Dane> clojars is working for me. Can you gist the output you see?
2017-10-30T08:12:36.000414
Candi
clojurians
clojure
<@Candi> <https://gist.github.com/anonymous/4bd2d48f05502968313e8b0cdc656826> here is the output
2017-10-30T09:15:12.000132
Dane
clojurians
clojure
What is the output of `lein version`?
2017-10-30T09:16:38.000215
Candi
clojurians
clojure
Leiningen 2.8.1 on Java 1.7.0_51 Java HotSpot(TM) 64-Bit Server VM
2017-10-30T09:17:20.000362
Dane
clojurians
clojure
Did you just recently update lein? 2.8.0 changed the clojars url to point to the CDN instead of the server, and it's possible that old version of java doesn't have the proper TLS features to work with the CDN
2017-10-30T09:20:07.000133
Candi
clojurians
clojure
you definitely should update java
2017-10-30T09:21:06.000537
Cecilia
clojurians
clojure
1.7 reached it’s end of life ages ago
2017-10-30T09:21:19.000130
Cecilia
clojurians
clojure
yes i updated lein it 4-5 hours ago
2017-10-30T09:21:49.000412
Dane
clojurians
clojure
java 7 supports SNI which would be the most obvious reason for it to not work
2017-10-30T09:22:18.000194
Cecilia
clojurians
clojure
but then again, it might be the CDN is using very strict crypto algorithms for it’s TLS support which might not be supported by java 7
2017-10-30T09:22:56.000111
Cecilia
clojurians
clojure
I’m still with java 8, I haven’t updated to 9 because of clojure and lein
2017-10-30T09:23:20.000179
Geneva
clojurians
clojure
leiningen now works with java 9 with the latest update but one cannot say the same about all libraries
2017-10-30T09:23:43.000032
Cecilia
clojurians
clojure
It gives error on 9, at least it gave it to me, I don’t remember the error
2017-10-30T09:23:43.000083
Geneva
clojurians
clojure
and clojure 1.9-beta3 at least works with java 9
2017-10-30T09:24:00.000379
Cecilia
clojurians
clojure
i am now updating java then
2017-10-30T09:24:23.000097
Dane
clojurians
clojure
I saw some ppl saying to use clojure 1.9 with java 9, well, stable things should be with stable clojure for now (1.8)
2017-10-30T09:24:23.000461
Geneva
clojurians
clojure
We tested the CDN with the latest java 6 when we were setting it up, and it worked, but it's possible that was due to a patch release, and maybe there is a patch to java 7 that provides the same support
2017-10-30T09:24:26.000357
Candi
clojurians
clojure
<@Dane> stick with java 8 for now
2017-10-30T09:24:37.000090
Cecilia
clojurians
clojure
not everything is up to speed with java 9 which brought the module mechanism which is partly backwards incompatible
2017-10-30T09:24:59.000288
Cecilia
clojurians
clojure
(Clojure has always worked on Java 9, it was Lein and Boot that were late to the party. Both are fixed now)
2017-10-30T09:25:01.000461
Guillermo
clojurians
clojure
<@Guillermo> but clojure 1.8?
2017-10-30T09:25:21.000004
Geneva
clojurians
clojure
if you can't update java, you can add the following to your `:user` profile in `~/.lein/profiles.clj`: ``` :repositories [["clojars" {:url "<https://clojars.org/repo>"}]] :plugin-repositories [["clojars" {:url "<https://clojars.org/repo>"}]] ```
2017-10-30T09:25:30.000342
Candi
clojurians
clojure
Yup, that worked too <@Geneva>
2017-10-30T09:25:41.000137
Guillermo
clojurians
clojure
Hmm, I will try again with lein latest version
2017-10-30T09:26:01.000084
Geneva
clojurians
clojure
That will point you back at the server-based repo instead of the CDN
2017-10-30T09:26:26.000329
Candi
clojurians
clojure
which is what you were using before lein 2.8.0
2017-10-30T09:26:37.000215
Candi
clojurians
clojure
btw updating java solved the problem. Thanks all
2017-10-30T10:25:21.000220
Dane
clojurians
clojure
#lazyweb Has anyone here done performance comparisons of crypto from Java security providers (built-in or Bouncy Castle) vs. binding to a C library?
2017-10-30T12:36:28.000230
Guillermo
clojurians
clojure
I am working on a wrapper for a Java library (<https://github.com/ajoberstar/ike.cljj>) The library has a lot of varargs in it which can frequently be wrapped with clojure variadics. This requires a bit of arity overloading. The problem is that the original java has typed arguments in addition to differences in arity. What is the recommended way of dealing with this? Here is an example <https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createTempDirectory(java.nio.file.Path,%20java.lang.String,%20java.nio.file.attribute.FileAttribute...)> I have three ideas: 1) in the implementation for the particular arity, check the type of the object dynamically. 2) treat it like a multimethod, let the dispatch function decide. 3) create separate function names for the wrapping function.
2017-10-30T12:38:55.000404
Fairy
clojurians
clojure
<@Fairy> a lot of the wrappers libs turn FileAttribute... into a set of keywords. I would not force varargs on the caller.
2017-10-30T12:46:08.000191
Guillermo
clojurians
clojure
I wouldn't mind if a library _only_ helped me create a set of FileAttributes. I have no issues with calling interop code directly. A lot of times it's clearer. `(Files/createTempDirectory p s (make-a-set-of-attrs))`
2017-10-30T12:49:39.000168
Guillermo
clojurians
clojure
<@Guillermo> I see your point. The ugly bit is the java-vararg, if that were simpler then the wrapper is not doing much.
2017-10-30T12:53:09.000291
Fairy
clojurians
clojure
Varargs in java are just syntactic, it's still fixed arity under the hood. The overloads for createTempDirectory are 2-arity and 3-arity, the clojure ones could be the same thing.
2017-10-30T12:57:07.000371
Guillermo
clojurians
clojure
<@Guillermo> I think the point here is that a java-varargs list of options such as FileAttribute is better treated in clojure as a collection, probably a hashmap. In that case the 2-arity can check if the second arg is a map and make the right call. Another way would be to provide a function for constructing the options array from a hashmap and using the java interop directly.
2017-10-30T13:10:51.000271
Fairy
clojurians
clojure
sounds good.
2017-10-30T13:11:17.000772
Guillermo
clojurians
clojure
hashmap or simple keyword set `#{:read :write}`, since the attrs are only boolean flags
2017-10-30T13:11:57.000311
Guillermo
clojurians
clojure
Hi, Clojure intermediate here. What is the best way to read big endian binary file?
2017-10-30T13:13:33.000156
Alice
clojurians
clojure
<@Alice> do you need to make something that parses the binary contents, does it suffice to just get the bytes in an array?
2017-10-30T13:19:42.000080
Margaret
clojurians
clojure
Yes.
2017-10-30T13:20:28.000068
Alice
clojurians
clojure
which one?
2017-10-30T13:20:40.000169
Margaret
clojurians
clojure
Sorry, what exactly do you mean?
2017-10-30T13:22:30.000707
Alice
clojurians
clojure
for bytes, java.io.FileInputStream will set you up, for more complex parsing, gloss is a good clojure option <https://github.com/ztellman/gloss>
2017-10-30T13:22:40.000076
Margaret
clojurians
clojure
I mean - if you need bytes, that’s much simpler. If you need to parse a specific format, there’s libraries that help
2017-10-30T13:22:56.000510
Margaret
clojurians
clojure
Oh, I just need bytes. This library would just be overkill.
2017-10-30T13:23:43.000779
Alice
clojurians
clojure
<@Alice> simple example ```Clojure 1.9.0-beta3 (ins)user=&gt; (java.io.FileInputStream. "/etc/passwd") #object[java.io.FileInputStream 0x41709512 "java.io.FileInputStream@41709512"] (ins)user=&gt; (def input *1) #'user/input (ins)user=&gt; (.available input) 5253 (ins)user=&gt; (def contents (byte-array *1)) #'user/contents (ins)user=&gt; (.read input contents) 5253 (ins)user=&gt; (into [] contents) [35 35 10 35 32 85 115 101 114 32 68 97 116 97 98 97 115 101 10 35 32 10 35 32 7 8 111 116 101 32 116 104 97 116 32 116 104 105 115 32 102 105 108 101 32 105 115 32 99 111 110 115 117 108 116 101 100 32 100 105 114 101 99 116 108 121 32 111 110 108 121 32 119 104 101 110 32 116 104 101 32 115 121 115 116 101 109 32 105 115 32 114 117 110 110 ... ]```
2017-10-30T13:25:41.000188
Margaret
clojurians
clojure
<@Alice> one gotcha with java in general is bytes are always signed, but there’s simple bitwise math tricks that allow all the operations you would expect despite the signedness
2017-10-30T13:26:38.000212
Margaret
clojurians
clojure
Thank you very much. I just found `with-open` and `input-stream` functions. Does they do the same job?
2017-10-30T13:28:03.000325
Alice
clojurians
clojure
input-stream doesn’t help much there since FileInputStream just gives you the thing - but with-open does help if you want to have it automatically close when exiting a specific scope
2017-10-30T13:28:44.000513
Margaret
clojurians
clojure
FileInputStream is already an InputStream - though I guess you can use input-stream if you want a BufferedInputStream instead?
2017-10-30T13:30:13.000649
Margaret
clojurians
clojure
Yep, I'll work with big files, so BufferedInputStream is probably a better choice. Anyway, I think I've got it. Thanks again.
2017-10-30T13:32:48.000425
Alice
clojurians
clojure
I don’t think that’s what the buffer on BufferedInputStream is about at all
2017-10-30T13:33:11.000646
Margaret
clojurians
clojure
it adds mark and reset support for streams that don’t implement those methods, but FileInputStream already gives you those methods
2017-10-30T13:33:36.000291
Margaret
clojurians
clojure
it’s not a file buffer for performance, it’s a software buffer for replay
2017-10-30T13:33:54.000203
Margaret
clojurians
clojure
if file usage needs to be optimized, there are things in java.nio for mmaping where supported
2017-10-30T13:34:41.000108
Margaret
clojurians
clojure
Would someone know why the following works in Java: ``` KafkaMetricsReporter$.MODULE$.startReporters(new VerifiableProperties(props)) ``` But cannot seem to reach `$.MODULE$.startReporters` from Clojure? (from <https://stackoverflow.com/a/47012396/1327651> )
2017-10-30T13:53:56.000732
Jonnie
clojurians
clojure
$ is part of the name, it’s not it’s own thing
2017-10-30T13:55:36.000545
Margaret
clojurians
clojure
it would be `(-&gt; KafkaMetricsReporter$ (.MODULE$) (.startReporters (VerifiableProperties. props)))`
2017-10-30T13:56:42.000451
Margaret
clojurians
clojure
Anyone know if there's an already built solution to logging slow tests with leiningen? (i.e. when running `lein test`, if a `deftest` block takes longer than some specified (or assumed) amount of time, it prints a warning)?
2017-10-30T14:04:35.000780
Raul