workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
clojurians | clojure | Sure, let me try and come up with a minimum repro | 2017-11-11T15:05:49.000086 | Necole |
clojurians | clojure | Nevermind, I can't reproduce. I'm basically doing:
```
(doseq [i [1 2 3 4 5]]
(println i)
(assert (< i 4) "Too big!"))
```
but with something more complicated. | 2017-11-11T15:08:20.000057 | Necole |
clojurians | clojure | Error is being swallowed somewhere else probably. | 2017-11-11T15:08:29.000029 | Necole |
clojurians | clojure | Open to hearing about any better patterns for this sort of thing. | 2017-11-11T15:08:57.000016 | Necole |
clojurians | clojure | Does anybody have experience using Akka via okku? The design looks ok, documentation decent, and it shows up in a "Clojure Programming Cookbook", but the original author admits in a PR comment that it was more of a proof of concept and that he never really used it (as of 2015, at least). | 2017-11-11T17:51:23.000013 | Valorie |
clojurians | clojure | <@Judy> I've been told I should ask you about this. I'm trying to get lein-droid to work and it's having a ClassNotFoundException, not able to find the GenericVersionScheme class from org.sonatype.aether/aether-util. Is there a good alternative to building clojure for droid these days? | 2017-11-11T23:20:31.000015 | Tyisha |
clojurians | clojure | <@Tyisha> You might check the <#C07JPKQ5S|clojure-android> channel as well. Not sure how active it is... | 2017-11-11T23:55:23.000028 | Daniell |
clojurians | clojure | Thanks. I'll check it out. It wasn't visible to me at first. | 2017-11-11T23:58:20.000049 | Tyisha |
clojurians | clojure | We have a *lot* of channels here. It can be hard to navigate sometimes! | 2017-11-12T00:01:13.000020 | Daniell |
clojurians | clojure | Java interop question: I would like to take the results of a datomic query and construct a java object with them. Rather than doing `(MyObj. (first result) (second result))` I would like to use apply to pass the arguments to the constructor of MyObj. However when I try to do that I get a compiler error. I'm guessing that just means that the . constructor is not actually a function. Is there a clean way to do this? | 2017-11-12T00:58:14.000056 | Lenita |
clojurians | clojure | <@Lenita> The only thing that comes to mind is to write a Clojure wrapper for your constructor: `(defn my-obj [a b c d] (MyObj. a b c d))` or whatever you need and then you should be able to `(apply my-obj result)` | 2017-11-12T01:06:24.000040 | Daniell |
clojurians | clojure | <@Daniell> i think i'll do the inline version of that `(apply #(MyObj. %1 %2 %3) results)` which is definitely less awkward than what I had before. thanks! | 2017-11-12T01:30:37.000036 | Lenita |
clojurians | clojure | what is the best way to handle a function in a pipeline that expects the piped value as the first arg when all the others expect it as the last arg. Is there a nice way to use an anonymous function to do that? | 2017-11-12T02:34:50.000009 | Lenita |
clojurians | clojure | <@Lenita> you can use `as->` (<https://clojuredocs.org/clojure.core/as-%3E>) if functions expect the argument to be at different positions | 2017-11-12T02:36:43.000035 | Terra |
clojurians | clojure | <@Terra> thats awesome. thanks. | 2017-11-12T02:41:52.000028 | Lenita |
clojurians | clojure | <@Lenita> You can start with `->` and have a nested `->>` for the "last" position and then your first position expression (and then another nested `->>` if you need it). | 2017-11-12T03:19:20.000048 | Daniell |
clojurians | clojure | <@Daniell> that seems like a good solution too. I like that with `as->` I can call out a name to help my readers follow the transformations through the pipeline. | 2017-11-12T04:16:26.000009 | Lenita |
clojurians | clojure | hi! is there a command in CIDER to "jump to a namespace"? (I type the namespace and it opens it in a buffer) | 2017-11-12T05:28:47.000051 | Lieselotte |
clojurians | clojure | ah found it: cider-browse-ns-all | 2017-11-12T05:36:04.000005 | Lieselotte |
clojurians | clojure | <@Lieselotte> also `cider-find-var` does the job. I place the cursor over a namespace (in the `:require` section), or simply over an interesting fn/var elsewhere
this code avoids being redundantly prompted:
```
(defun jump-to-clojure-definition ()
(interactive)
(let* ((old cider-prompt-for-symbol))
(setq cider-prompt-for-symbol nil)
(cider-find-var)
(setq cider-prompt-for-symbol old)))
``` | 2017-11-12T07:18:10.000067 | Kristy |
clojurians | clojure | there's also `cider-find-ns` | 2017-11-12T08:25:15.000060 | Terra |
clojurians | clojure | I’m trying to follow Carin Meier’s lein-jupyter walkthrough of the cats and dogs challenge. I’m stuck getting the jupyter notebook to launch without throwing an exception (I assume can’t find the clojure kernel, which is installed).... ? | 2017-11-12T11:30:43.000051 | Kyung |
clojurians | clojure | <@Kyung> try the <#C0BQDEJ8M|data-science> channel, Carin's active there. | 2017-11-12T11:32:52.000010 | Bibi |
clojurians | clojure | is there a simpler way of writing (def color-regex #"^#[0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z]")
-- I need this to work in a cljc file, so it needs to work in both js and jvm | 2017-11-12T11:45:54.000013 | Berry |
clojurians | clojure | will `re-pattern` help?
`cljs`: <https://crossclj.info/fun/cljs.core.cljs/re-pattern.html>
`clj`: <https://clojuredocs.org/clojure.core/re-pattern> | 2017-11-12T11:58:27.000045 | Eloisa |
clojurians | clojure | javascript allows for `{n}` so you could do `#^[0-9a-z]{6}` | 2017-11-12T11:59:39.000088 | Willow |
clojurians | clojure | and i imagine that jvm supports that as well | 2017-11-12T11:59:48.000024 | Willow |
clojurians | clojure | I misunderstood ... +1 to what dan said above ^ | 2017-11-12T12:02:44.000072 | Eloisa |
clojurians | clojure | if you want something that looks a bit more explicit and you don't like regex syntax you could do something like `(let [digits (repeat "[0-9a-z]")] (re-find (re-pattern (clojure.string/join (take 6 digits))) "aaaaaa"))` | 2017-11-12T12:10:42.000133 | Willow |
clojurians | clojure | Re: `clojure.jdbc` - Does using `with-db-transaction` close the connection after it's finished? It's not immediately obvious from the API documentation | 2017-11-12T14:51:50.000037 | Bronwyn |
clojurians | clojure | hi! in a clojure doc string, how to refer the reader to another function? similar to what can be done in javadoc as {<AT SIGN>link Whatever} | 2017-11-12T15:33:00.000016 | Lieselotte |
clojurians | clojure | <@Lieselotte> with backticks, normally clojure-mode will syntax-highlight it | 2017-11-12T15:37:37.000019 | Kristy |
clojurians | clojure | <@Kristy> thanks! | 2017-11-12T15:45:35.000092 | Lieselotte |
clojurians | clojure | <@Bronwyn> You might try <#C1Q164V29|sql>. | 2017-11-12T15:51:25.000006 | Cherelle |
clojurians | clojure | <@Willow>: [0-9a-f]{6} is perfect | 2017-11-12T16:44:13.000034 | Berry |
clojurians | clojure | <@Bronwyn> Sorry, only just saw your question. Yes, `with-db-transaction` closes the connection as well as committing the transaction (or rolling it back if there's an exception). | 2017-11-12T18:24:19.000059 | Daniell |
clojurians | clojure | Hello. I am learning clojure, lambda calculus, computation theory and architectural design | 2017-11-12T22:19:04.000041 | Pamela |
clojurians | clojure | Well Clojure is a good place to start for this, except maybe computation theory :) | 2017-11-13T02:33:52.000270 | Danyel |
clojurians | clojure | <@Bronwyn> there is built-in feature to re-use connections: <http://clojure-doc.org/articles/ecosystem/java_jdbc/reusing_connections.html#using-connection-pooling>
also, check for special libraries that manage connection pooling. We use <https://github.com/tomekw/hikari-cp> in our Postgres-driver Clojure project. | 2017-11-13T02:37:31.000188 | Verna |
clojurians | clojure | <@Bronwyn> moreover, take a look at conman library. It’s a mixture of HugSQL + connection pooling + small details that make everything work fine. <https://github.com/luminus-framework/conman> | 2017-11-13T02:39:18.000009 | Verna |
clojurians | clojure | Hey guys,
4Clojure problems updated on Clojurecademy - <https://clojurecademy.com/courses/17592186045426/learn/syllabus> | 2017-11-13T05:29:04.000015 | Misti |
clojurians | clojure | hi guys | 2017-11-13T05:48:48.000382 | Mallory |
clojurians | clojure | what is the wrong with this code <https://gist.github.com/aibrahim/f48b8d35eaa4e63013dd66e07fce47cc>
StackOverflowError java.math.MutableBigInteger.divide (MutableBigInteger.java:1153) | 2017-11-13T05:49:15.000036 | Mallory |
clojurians | clojure | why clojure breaks for recursion like this | 2017-11-13T05:49:31.000230 | Mallory |
clojurians | clojure | ? | 2017-11-13T05:49:31.000487 | Mallory |
clojurians | clojure | You're not using tail recursion, so the stack will explode. And I think you're using "normal" integers alongside bigints. It may be out of date, but this could be helpful <https://dev.clojure.org/display/design/Documentation+for+1.3+Numerics> | 2017-11-13T05:51:17.000488 | Cora |
clojurians | clojure | I doubt it will fix it but you could try adding an `M` suffix to your numbers like `(/ n 2M)`. But you may want to redesign your algorithm to use the `recur` form in the tail position. <https://clojuredocs.org/clojure.core/recur> | 2017-11-13T05:52:57.000261 | Cora |
clojurians | clojure | why recursion like this not working in clojure? | 2017-11-13T05:54:10.000235 | Mallory |
clojurians | clojure | <@Mallory> also your code will logically never return, if you run `(fast-fib 5)`, you will never reach the the case `n=0` | 2017-11-13T05:54:35.000367 | Hedwig |
clojurians | clojure | you always divide the argument by two and call it again | 2017-11-13T05:54:50.000044 | Hedwig |
clojurians | clojure | works | 2017-11-13T05:55:01.000275 | Mallory |
clojurians | clojure | user=> (fast-fib 3)
[2 3]
user=> (fast-fib 10)
[55 89]
user=> (fast-fib 5)
[5 8] | 2017-11-13T05:55:03.000103 | Mallory |
clojurians | clojure | only added 2M as olical suggested | 2017-11-13T05:55:14.000111 | Mallory |
clojurians | clojure | user=> (fast-fib 100)
ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow (Numbers.java:1501) | 2017-11-13T05:55:32.000380 | Mallory |
clojurians | clojure | should not work... | 2017-11-13T05:55:33.000046 | Hedwig |
clojurians | clojure | Because you're not using `recur` in the tail position though, it will blow the stack at some point. | 2017-11-13T05:55:54.000082 | Cora |
clojurians | clojure | ```
(defn fast-fib [n]
(if (== n 0)
[0, 1]
(let [[a, b] (fast-fib (int (/ n 2)))
c (* a (- (* b 2) a))
d (+ (* a a) (* b b))]
(if (zero? (mod n 2))
[c, d]
[d, (+ c d)]))))
``` | 2017-11-13T05:57:15.000041 | Hedwig |
clojurians | clojure | you have to do integer coercion | 2017-11-13T05:57:20.000535 | Hedwig |
clojurians | clojure | otherwise you never reach the end, tail recursion is not the main problem here | 2017-11-13T05:57:46.000408 | Hedwig |
clojurians | clojure | A couple nit-picky points about your code: you can omit the commas (they are whitespace in Clojure) and your `(zero? (mod n 2))` is equivalent to `(even? n)`. Not a big deal in either case though. :simple_smile: | 2017-11-13T07:56:48.000324 | Adelaida |
clojurians | clojure | <@Mallory> - In case that wasn't obvious, he put a call to `int` around the `(/ n 2)`. `(/ 1 2)` evaluates to `1/2` (the fraction), but `(int (/ 1 2))` evaluates to `0`. | 2017-11-13T08:00:52.000110 | Adelaida |
clojurians | clojure | if I have :profiles :dev in my project.clj, under what conditions does that profile take effect by default without my explicit use of with-profile ? | 2017-11-13T10:11:39.000024 | Marnie |
clojurians | clojure | Why doesn’t `run!` take an init argument? | 2017-11-13T10:48:18.000852 | Johana |
clojurians | clojure | because `run!` is about consuming each element individually, not accumulating | 2017-11-13T10:50:39.000446 | Guillermo |
clojurians | clojure | ok, I needed some state in my `proc` (alternating boolean), so I just used `reduce` | 2017-11-13T10:51:26.000229 | Johana |
clojurians | clojure | could have used `map-indexed`, but doesn’t matter I guess | 2017-11-13T10:52:45.000099 | Johana |
clojurians | clojure | <@Johana> If it's a vector you can use `reduce-kv` and check for `even? / odd?` to get alternating booleans | 2017-11-13T10:56:56.000034 | Randee |
clojurians | clojure | in hindsight I couldn’t use the index at all, because it depends… | 2017-11-13T10:57:21.000422 | Johana |
clojurians | clojure | so I need reduce for sure, but don’t need the end result.. hence my question :slightly_smiling_face: | 2017-11-13T10:57:39.000373 | Johana |
clojurians | clojure | then again, the end result is a boolean, so who cares. | 2017-11-13T10:58:05.000207 | Johana |
clojurians | clojure | I have a strange situation. A function works as expected in repl (freshly started, no old state build up) but not from a compiled uberjar.
```
(defn print-router-config [rcfg]
(log/info "printing router config")
(println rcfg)
(let [cfg (:customer-router-config rcfg)
fname (str (:region account) "_" (:alias account) "_" (:virtual-interface-id rcfg) "_" (:location rcfg) ".txt")]
(spit fname (xml->json (xml/parse (java.io.ByteArrayInputStream. (.getBytes cfg)))))))
(defn download-router-config [account]
(log/info "doing the thing")
(let [cfgs (get-router-configs account)]
(println "should map print over cfgs now")
(println (type cfgs))
(println (count cfgs))
(println (type (first cfgs)))
(map print-router-config cfgs)))
```
the `print-router-config` function doesn't get called over `cfgs`. any pointers appreciated.. | 2017-11-13T12:09:35.000112 | Kathe |
clojurians | clojure | map is lazy | 2017-11-13T12:16:11.000020 | Rebeca |
clojurians | clojure | You can simply replace `map` with `run!` | 2017-11-13T12:26:10.000463 | Giovanna |
clojurians | clojure | thanks <@Rebeca>, <@Giovanna>! obviously i don't really understand laziness. reading <https://stuartsierra.com/2015/08/25/clojure-donts-lazy-effects> now. any other resources/books that may help with clarity? | 2017-11-13T12:29:08.000402 | Kathe |
clojurians | clojure | `run!` did the trick!! yay. thank you so much. | 2017-11-13T12:31:50.000536 | Kathe |
clojurians | clojure | Apologies if this is the wrong channel, but is anyone else having trouble accessing <http://jarkeeper.com/>? I'm getting an "Origin DNS error" message from CloudFlare. | 2017-11-13T14:58:13.000411 | Leonida |
clojurians | clojure | <@Leonida> Maven Central reported a DNS issue that seems to have screwed a lot of build systems up... | 2017-11-13T14:59:20.000124 | Daniell |
clojurians | clojure | <https://twitter.com/sonatype_ops/status/930138391005589505> | 2017-11-13T14:59:41.000267 | Daniell |
clojurians | clojure | Ah ok - jarkeeper uses central for some of its info, I presume? | 2017-11-13T14:59:41.000294 | Leonida |
clojurians | clojure | Jarkeeper is down at the moment, it's been down for a few weeks now | 2017-11-13T15:00:06.000316 | Shira |
clojurians | clojure | I was seeing Travis builds failing all over the place this morning (while trying to release a new version of `clj-time`). | 2017-11-13T15:00:13.000789 | Daniell |
clojurians | clojure | Oh, so this is unrelated? OK, I'll get back in my box... :smiling_imp: | 2017-11-13T15:00:49.000414 | Daniell |
clojurians | clojure | <@Leonida> I just announced <https://versions.deps.co/> which provides the same service as Jarkeeper (and was forked from it) | 2017-11-13T15:00:52.000491 | Shira |
clojurians | clojure | Thanks <@Shira>! | 2017-11-13T15:01:09.000588 | Leonida |
clojurians | clojure | I'm a big fan "public self shaming" as a motivation technique. :wink: | 2017-11-13T15:01:43.000115 | Leonida |
clojurians | clojure | Jarkeeper-type tools are great for this. | 2017-11-13T15:01:52.000440 | Leonida |
clojurians | clojure | When I deploy my release to clojars, printing `Failed to deploy artifacts/metadata: Cannot access releases with type default using the available connector factories: BasicRepositoryConnectorFactory`` | 2017-11-13T16:32:42.000621 | Olen |
clojurians | clojure | What is that mean ? | 2017-11-13T16:32:59.000099 | Olen |
clojurians | clojure | What tool are you deploying with? | 2017-11-13T16:38:11.000012 | Candi |
clojurians | clojure | leiningen. | 2017-11-13T16:41:09.000296 | Olen |
clojurians | clojure | which profile in project.clj is the one that is distributed in a clojars dependency? | 2017-11-13T17:55:54.000351 | Marnie |
clojurians | clojure | Can it be that clojure spews out `clojure.lang.LazySeq@1f` file-directories when useing `io/file` within for loop. Wondering how I can prevent this. | 2017-11-14T05:47:10.000108 | Lily |
clojurians | clojure | This is in the target directory, so maybe this is expected? | 2017-11-14T05:48:16.000204 | Lily |
clojurians | clojure | `for` produces a lazy sequence | 2017-11-14T05:51:51.000169 | Danuta |
clojurians | clojure | yes, but what explains these directories
```
$ ls target/
clojure.lang.LazySeq@1f clojure.lang.LazySeq@316eef clojure.lang.LazySeq@92aa04bb src
clojure.lang.LazySeq@30b541e8 clojure.lang.LazySeq@712f77fe
``` | 2017-11-14T05:54:17.000082 | Lily |
clojurians | clojure | useing doall did not prevent this | 2017-11-14T05:55:22.000340 | Lily |
clojurians | clojure | possibly something is getting a name for a directory by calling `str` on the lazy sequence | 2017-11-14T05:56:52.000317 | Danuta |
clojurians | clojure | yes that's right, I call `.isAbsolute` `.exists` `.getPath` and `.getName`. | 2017-11-14T05:58:03.000435 | Lily |
clojurians | clojure | well, maybe this is harmless and I just let them be or remove them when needed. | 2017-11-14T05:59:39.000487 | Lily |
clojurians | clojure | even more percice, this is inside the lazy sequence
`(io/file (str proj sep) classp)` | 2017-11-14T06:02:19.000163 | Lily |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.