workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
clojurians | clojure | why the `(str proj sep)`? | 2017-11-14T06:03:16.000500 | Danuta |
clojurians | clojure | yes it's stupid, should only be proj and classp. | 2017-11-14T06:03:48.000158 | Lily |
clojurians | clojure | here's the function <https://pastebin.com/B3vtXJJH> | 2017-11-14T06:06:34.000259 | Lily |
clojurians | clojure | hello. I’m trying to do a simple http call using using `clj-http` package:
```
(defn -main
[]
(client/get "<https://jsonplaceholder.typicode.com/users>"
(fn [response] (println response)))``` | 2017-11-14T06:25:45.000070 | Tameka |
clojurians | clojure | and I’m getting the following error | 2017-11-14T06:25:58.000382 | Tameka |
clojurians | clojure | ```Exception in thread "main" java.lang.RuntimeException: EOF while reading, starting at line 4, compiling:(samsing/core.clj:10:1)``` | 2017-11-14T06:26:00.000204 | Tameka |
clojurians | clojure | missing a closing parenthesis there? | 2017-11-14T06:26:54.000420 | Lily |
clojurians | clojure | ah damn it :smile: | 2017-11-14T06:27:31.000193 | Tameka |
clojurians | clojure | I feel so stupid haha | 2017-11-14T06:27:43.000210 | Tameka |
clojurians | clojure | been there :wink: | 2017-11-14T06:27:52.000302 | Lily |
clojurians | clojure | thank you, that solved it | 2017-11-14T06:28:34.000162 | Tameka |
clojurians | clojure | and one more question :smile: it doesn’t seem to decode to json, no matter what option I pass | 2017-11-14T07:00:19.000525 | Tameka |
clojurians | clojure | for example I’m doing the following | 2017-11-14T07:00:29.000519 | Tameka |
clojurians | clojure | ```client/get url {:async? true :as :json} handle-response handle-exception``` | 2017-11-14T07:00:49.000493 | Tameka |
clojurians | clojure | nvm, this solved it:
<https://stackoverflow.com/questions/37264250/clj-http-not-returning-json> | 2017-11-14T07:08:11.000044 | Tameka |
clojurians | clojure | I'm looking for a debugging library I saw recently (on reddit, probably), but can't seem to find it now. I only looked at it for a moment, but I believe it involved one or more macros for writing values to an atom. Something like that.
Anyone know what I'm talking about? | 2017-11-14T08:10:08.000515 | Sommer |
clojurians | clojure | I put my lib in <#C06MAR553|announcements> recently, and it involves some functions for putting stuff in an atom. They're not macros though, just functions. Lib: <https://github.com/madstap/hugin>
Blog post: <https://madstap.github.io/posts/dbg/> | 2017-11-14T08:19:13.000328 | Giovanna |
clojurians | clojure | That's it! thanks. I checked <#C06MAR553|announcements>, before posting this, but I guess I missed it. | 2017-11-14T08:20:26.000189 | Sommer |
clojurians | clojure | I used to use spyscope (but it stopped working for me??), then I wrote sayid, but sometimes I still use `def` and `pprint`. Some of those times, I think I want something like hugin. | 2017-11-14T08:26:13.000196 | Sommer |
clojurians | clojure | is there any way to "transduce" this?
```(frequencies
(reduce #(if (not (nil? (:samplevalue %2)))
(conj %1 (.intValue (:samplevalue %2)))) []
(qos/device-qos-range origem device qos alvo inicio fim))) ``` | 2017-11-14T08:40:49.000101 | Lois |
clojurians | clojure | device-qos-range returns collection of numbers | 2017-11-14T08:41:50.000214 | Lois |
clojurians | clojure | [1 2 3 100 200 ...] | 2017-11-14T08:42:06.000235 | Lois |
clojurians | clojure | Looks like slack swallowed it... | 2017-11-14T08:48:39.000535 | Giovanna |
clojurians | clojure | literally, more or less this:
```
(frequencies
(eduction
(keep :samplevalue)
(map (memfn intValue))
[{:samplevalue 3.1} {:samplevalue 2} nil]))
``` | 2017-11-14T08:54:29.000427 | Eliana |
clojurians | clojure | you have the `:samplevalue` to deal with | 2017-11-14T08:54:55.000108 | Eliana |
clojurians | clojure | Yeah, def and pprint work great, but you have to put them in a `do`. Apart from the debug atom, hugin has `def<` and `pp<` respectively that you can wrap around an arbitrary expression without changing how the code works. | 2017-11-14T08:55:11.000057 | Giovanna |
clojurians | clojure | (update, just added) | 2017-11-14T08:57:55.000304 | Eliana |
clojurians | clojure | <@Eliana> Thanks, I´ll try it | 2017-11-14T09:20:14.000486 | Lois |
clojurians | clojure | why `frequencies` does not be in `transduce` args? | 2017-11-14T09:21:45.000305 | Lois |
clojurians | clojure | there is no frequencies transducer | 2017-11-14T09:22:17.000712 | Eliana |
clojurians | clojure | it´s so confuse :neutral_face: | 2017-11-14T09:22:49.000192 | Lois |
clojurians | clojure | so `keep` and `map` are "transdusible" ? | 2017-11-14T09:23:57.000006 | Lois |
clojurians | clojure | they provide an arity that returns a transducer | 2017-11-14T09:24:55.000446 | Erlinda |
clojurians | clojure | Has anyone ever used docjure for Excel file generation? Having an issue where even though I specify `:data-format` it doesn't ever get applied to the generated file. | 2017-11-14T10:23:20.000159 | Laci |
clojurians | clojure | actually `frequencies` is the reducing step here <@Lois> so you can compact everything into:
```
(transduce
(comp
(keep :samplevalue)
(map (memfn intValue)))
(completing #(assoc! %1 %2 (inc (get %1 %2 0))) persistent!)
(transient {})
[{:samplevalue 3.1} {:samplevalue 2} nil])
``` | 2017-11-14T10:33:10.000261 | Eliana |
clojurians | clojure | <@Eliana> about performance, what do you think is most performatic? | 2017-11-14T10:35:21.000244 | Lois |
clojurians | clojure | Does anyone know of a way to get the frame-local variables printed during stacktraces? | 2017-11-14T10:39:15.000305 | Candie |
clojurians | clojure | I've done a little googling, and read some of `clojure.stacktrace`, but nothing seems promising. | 2017-11-14T10:40:24.000585 | Candie |
clojurians | clojure | how big is input coll? | 2017-11-14T10:46:58.000517 | Eliana |
clojurians | clojure | I don't think this is possible.
<https://stackoverflow.com/questions/4620430/getting-local-variables> | 2017-11-14T10:48:41.000555 | Terra |
clojurians | clojure | Ahh, good point. | 2017-11-14T10:50:44.000008 | Candie |
clojurians | clojure | I've never attempted to extend Throwables, a la `slingshot`, but maybe that would be the way to go: create Throwables that automatically capture their local variables. | 2017-11-14T10:51:29.000071 | Candie |
clojurians | clojure | 9k | 2017-11-14T10:55:25.000798 | Lois |
clojurians | clojure | <@Eliana> too much isn´t? It´s a timeseries informations | 2017-11-14T10:57:17.000049 | Lois |
clojurians | clojure | not particoularly I guess... | 2017-11-14T10:59:36.000201 | Eliana |
clojurians | clojure | so the benchmark are roughly the same | 2017-11-14T10:59:45.000331 | Eliana |
clojurians | clojure | This blog seems to have some of the answer, from a frame-local-variables perspective: <http://blog.element84.com/debugging-clojure-with-jdi.html> | 2017-11-14T11:02:54.000838 | Candie |
clojurians | clojure | in a cljc file, I have; | 2017-11-14T11:06:40.000336 | Berry |
clojurians | clojure | ```
#?(:clj [b.acompat.macro :refer [read-at-compile-time]]
:cljs [b.acompat.macro :refer-macros [read-at-compile-time]])
```
^-- can this be simplified ? | 2017-11-14T11:06:49.000570 | Berry |
clojurians | clojure | <@Berry> narrow the reader conditional to the `:refer` / `:refer-macros` (as far as I can tell, that's the only difference) | 2017-11-14T11:09:55.000752 | Malka |
clojurians | clojure | How do I get this to work? `(clojure.java.shell/sh “rm” “/tmp/out/*“)` | 2017-11-14T11:11:40.000380 | Johana |
clojurians | clojure | The wildcard doesn’t work | 2017-11-14T11:11:56.000166 | Johana |
clojurians | clojure | <@Malka>: maybe this is asking too much, but it seems that at compile time, it should be possible to infer if a symbol if a function or a macro, and have it behave accodingly | 2017-11-14T11:12:56.000519 | Berry |
clojurians | clojure | <@Berry> are you the author of the `b.acompat.macro` namespace? | 2017-11-14T11:13:39.000090 | Malka |
clojurians | clojure | <@Malka> I am author of the b.acompat.macro namespace | 2017-11-14T11:14:10.000279 | Berry |
clojurians | clojure | ok, `(clojure.java.shell/sh "bash" "-c" "rm /tmp/out/*")` works | 2017-11-14T11:15:39.000506 | Johana |
clojurians | clojure | <@Berry> there's a cljs feature called 'implicit macro loading'; add `#?(:cljs (:require-macros [b.acompat.macro]))` to your `b.acompat.macro` ns form and you can `:refer` your macros as usual | 2017-11-14T11:17:57.000208 | Malka |
clojurians | clojure | <@Malka>: are you suggesting:
```
;; foobar/macro.cljc
(ns foobar.macro
#?(:cljs (require-macros [foobar.macro])))
(defmacro black-magic [ ...])
;; other/code.cljc
(ns other.code
(:require [foobar.macro :refer [black-magic]]))
```
? | 2017-11-14T11:20:08.000675 | Berry |
clojurians | clojure | yes (minor nitpick: it should be `:require-macros`, with the colon) | 2017-11-14T11:21:27.000768 | Malka |
clojurians | clojure | <@Malka>: thanks; this is interesting; I will try it out once my cljs code compiles again | 2017-11-14T11:23:01.000174 | Berry |
clojurians | clojure | Oh right, this reminds me that wildcards are a creature comfort provided by shells. :simple_smile: | 2017-11-14T11:38:51.000348 | Adelaida |
clojurians | clojure | Why does `=` accept one argument? | 2017-11-14T12:25:00.000511 | Johana |
clojurians | clojure | because of `apply` | 2017-11-14T12:26:52.000528 | Guillermo |
clojurians | clojure | you can apply multiple args, so what is so special about one arg | 2017-11-14T12:27:09.000296 | Guillermo |
clojurians | clojure | Maybe because of transducers? | 2017-11-14T12:30:26.000677 | Candie |
clojurians | clojure | no | 2017-11-14T12:30:48.000849 | Kareen |
clojurians | clojure | Fair enough | 2017-11-14T12:36:00.000521 | Candie |
clojurians | clojure | Question: How do people feel about memoizing a function that performs IO to get something out of a database? | 2017-11-14T12:42:31.000727 | Sophie |
clojurians | clojure | Does that raise red flags for anyone in and of itself? | 2017-11-14T12:42:55.000085 | Sophie |
clojurians | clojure | <@Lois> Depending how important speed is, the parallel solution is twice as fast, at the price of the increased complexity. I collected all in a gist: <https://gist.github.com/reborg/37c76a61c9a60ddae8de737170e2e675>
Before going parallel like this tho (with mutation, side-effects and whatnot), I'd carefully weight pro and cons. The very first solution with `frequencies` and `eduction` was easy to read and good 98% of the use cases. | 2017-11-14T12:43:36.000366 | Eliana |
clojurians | clojure | How do you analyze if the query is pure of makes updates ? | 2017-11-14T12:44:16.000381 | Berry |
clojurians | clojure | <@Eliana> thanks a lot for your help | 2017-11-14T12:47:50.000764 | Lois |
clojurians | clojure | no worries, all useful stuff :slightly_smiling_face: | 2017-11-14T12:48:21.000109 | Eliana |
clojurians | clojure | I used the second solution in my code | 2017-11-14T12:48:23.000079 | Lois |
clojurians | clojure | like so many things it depends | 2017-11-14T12:50:00.000425 | Myles |
clojurians | clojure | depends on how often you're writing to the db | 2017-11-14T12:50:11.000472 | Myles |
clojurians | clojure | depends on the load | 2017-11-14T12:50:15.000110 | Myles |
clojurians | clojure | depends on whether having the latest info is critical | 2017-11-14T12:50:43.000769 | Myles |
clojurians | clojure | depends on how important speed is | 2017-11-14T12:51:08.000058 | Myles |
clojurians | clojure | I’m thinking of this from a readability / obviousness perspective for the benefit of the human reading the code down the road. | 2017-11-14T12:55:59.000398 | Sophie |
clojurians | clojure | Right now the application should only need to read the data once for the duration of the app. | 2017-11-14T12:56:15.000809 | Sophie |
clojurians | clojure | And I’m thinking of memoizing the function to keep things cleaner, so I don’t need to add yet one more thing to my global config | 2017-11-14T12:56:49.000789 | Sophie |
clojurians | clojure | But down the road, it’s possible that I would need to read from the DB more than once per application run. | 2017-11-14T12:57:10.000105 | Sophie |
clojurians | clojure | And I’m wondering if 6 months, a year from now, I would remember that the function was memoized, or if I would tear my hair out wondering why it isn’t reading new data in the DB | 2017-11-14T12:57:46.000376 | Sophie |
clojurians | clojure | :slightly_smiling_face: | 2017-11-14T12:57:47.000402 | Sophie |
clojurians | clojure | anyway, just seeing if people have experience or strong opinions about this sort of thing | 2017-11-14T12:58:37.000535 | Sophie |
clojurians | clojure | I would certainly avoid adding this until it's necessary | 2017-11-14T13:00:52.000516 | Myles |
clojurians | clojure | I'm trying to write a function that converts an unqualified keyword to a qualified keyword. I have this so far:
```
(defn qkw [kw]
(keyword (str (ns-name *ns*))
(str (name kw))))
```
unfortunately, it doesn't work in cljc as *ns* is undefined in cljs
is there a way to make this work in cljs too ? | 2017-11-14T13:01:15.000819 | Berry |
clojurians | clojure | too often I see myself to 'clever' stuff and then confuse myself the next day | 2017-11-14T13:01:17.000315 | Myles |
clojurians | clojure | haha, true story | 2017-11-14T13:07:08.000061 | Sophie |
clojurians | clojure | yeah, that’s why I was hesitant about this | 2017-11-14T13:07:14.000380 | Sophie |
clojurians | clojure | “Oh, memoizing is this clever, useful thing! I’ll use it!” But I’m not confident that it won’t burn me down the road | 2017-11-14T13:07:32.000589 | Sophie |
clojurians | clojure | I had to spin up a clojurescript repl to see it for myself and yep calling `*ns*` returns `nil` | 2017-11-14T13:15:21.000409 | Herlinda |
clojurians | clojure | I tried to post a message to the google group yesterday, but it hasn't appeared. It's possible that it got hung up in moderation; any moderators around? | 2017-11-14T13:15:44.000040 | Filomena |
clojurians | clojure | It's also possible that pressed the wrong button at some point. | 2017-11-14T13:16:01.000518 | Filomena |
clojurians | clojure | <@Berry> try this out `(defn qkw [kw] (keyword (namespace ::_) (str (name kw))))` | 2017-11-14T13:23:02.000370 | Herlinda |
clojurians | clojure | that almost works, except ::. gets us the namespace where qkw is defined, not where qkw is called | 2017-11-14T13:31:08.000031 | Berry |
clojurians | clojure | <@Filomena> I am one moderator of Clojure Google group. No messages are waiting for moderation approval right now. There are other moderators, so someone else may have seen it and made a reject decision on your message without me seeing it, but if your message was about Clojure, it shouldn't have been rejected. | 2017-11-14T13:35:58.000398 | Micha |
clojurians | clojure | <@Micha> ok, thanks; I'll resubmit and be very careful about which button I press this time. | 2017-11-14T13:36:26.000497 | Filomena |
clojurians | clojure | ah yes...more hammock time needed | 2017-11-14T13:43:15.000078 | Herlinda |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.