workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
clojurians | clojure | Perhaps the answer is: Clojure only accidentally works on doubles, and it is not the intended API. | 2017-11-18T10:31:10.000017 | Dirk |
clojurians | clojure | There is a cast to `int` sitting right in the `:inline` definition, though, so perhaps it is intentional. | 2017-11-18T10:31:53.000096 | Dirk |
clojurians | clojure | JavaScript also accepts doubles but interprets them as keys. Another source of confusion: should `aget` be more like the host or weird behavior in JVM Clojure | 2017-11-18T10:32:04.000055 | Johana |
clojurians | clojure | Valid question IMHO | 2017-11-18T10:33:07.000098 | Dirk |
clojurians | clojure | ```
x = {1.5: 1}
x[1.5] // 1
``` | 2017-11-18T10:33:50.000068 | Johana |
clojurians | clojure | I successfully wrote lots of ClojureScript, relying on Clojure's semantics, without ever having learned JavaScript. Perhaps this is an argument for staying away from host semantics when you can. | 2017-11-18T10:40:53.000041 | Dirk |
clojurians | clojure | Numbers and regexes have host semantics/implementations as well. | 2017-11-18T10:44:00.000075 | Johana |
clojurians | clojure | But like I said, it’s no big deal to move to goog.object for objects… just don’t understand the double behavior… maybe it has a reason… :slightly_smiling_face: | 2017-11-18T10:51:39.000030 | Johana |
clojurians | clojure | Maybe there is no reason for it <@Johana>. It could well just be an accident of a change made to avoid reflection <https://github.com/clojure/clojure/commit/742619e583400400e69cd46ab9e9536c10afb738> | 2017-11-18T10:53:42.000038 | Dirk |
clojurians | clojure | Hmm, commit message says ‘hints’ indeed… | 2017-11-18T10:54:59.000059 | Johana |
clojurians | clojure | isn't the int cast there so that clojure defaulting to longs doesn't make things inconvenient? | 2017-11-18T10:55:28.000066 | Margaret |
clojurians | clojure | That's the hypothesis (better support for `long`, not an intention to support `double`) | 2017-11-18T10:56:01.000084 | Dirk |
clojurians | clojure | without all the int casting clojure does, our code would get ugly with all the long->int conversions we would be doing every time we interact with methods | 2017-11-18T10:56:40.000044 | Margaret |
clojurians | clojure | So perhaps `(aget (into-array [1 2 3]) 0.1)` is not correct code and only works as an accident. | 2017-11-18T10:57:22.000128 | Dirk |
clojurians | clojure | I think so yes | 2017-11-18T10:57:29.000003 | Johana |
clojurians | clojure | Cool. I captured this concept in the relevant ClojureScript ticket <https://dev.clojure.org/jira/browse/CLJS-2149?focusedCommentId=47399&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-47399> | 2017-11-18T11:02:35.000082 | Dirk |
clojurians | clojure | I was doing some inspection of stacktraces, and I noticed that I don't have `clojure/lang/RT.java` on the classpath, only `clojure/lang/RT.class`. Is that normal? | 2017-11-18T11:30:17.000057 | Jodie |
clojurians | clojure | If it is normal, why is it this way? I have some other java sources on the classpath. | 2017-11-18T11:31:26.000062 | Jodie |
clojurians | clojure | why would a java file be on classpath? | 2017-11-18T11:32:04.000114 | Margaret |
clojurians | clojure | you can't run it | 2017-11-18T11:32:15.000053 | Margaret |
clojurians | clojure | <@Margaret> I presumed so that tooling could read it, is that not correct? | 2017-11-18T11:59:11.000118 | Jodie |
clojurians | clojure | <@Jodie> sources are often distributed as separate source jars, to reduce jar sizes | 2017-11-18T12:03:31.000099 | Carletta |
clojurians | clojure | <http://central.maven.org/maven2/org/clojure/clojure/1.9.0-RC1/> like -sources jar here | 2017-11-18T12:04:17.000060 | Carletta |
clojurians | clojure | ah, I've found that jar. Looks like cider has an open discussion about this: <https://github.com/clojure-emacs/cider-nrepl/issues/64> | 2017-11-18T12:04:19.000094 | Jodie |
clojurians | clojure | <https://gitlab.com/vise890/lein-pocketbook> works, even if very verbose. Interesting tool. | 2017-11-18T12:10:25.000094 | Jodie |
clojurians | clojure | Does anyone have any preferred Clojure libraries/wrappers for working with Apache Kafka? | 2017-11-18T13:52:47.000089 | Adelina |
clojurians | clojure | YMMV but I've had the most luck with avoiding clojure bindings as much as possible and using interop, I use a few things from clj-kafka (mostly for creating the objects) and a lot of interop once I have the things to work with | 2017-11-18T13:54:43.000001 | Margaret |
clojurians | clojure | <@Adelina> hi, btw, I think we met at clojure/west
for an example of why I avoid clojure bindings, there's a tendency to wrap side effecting IO operations in lazy abstractions, which is a technique that creates more problems than it solves | 2017-11-18T13:59:57.000053 | Margaret |
clojurians | clojure | the abstraction of lazy computation over IO is very lossy, you can't ignore the IO so now you have to keep track of two abstractions (the IO abstraction itself, plus the laziness abstraction) and the lazy thing will tend to break things | 2017-11-18T14:01:01.000064 | Margaret |
clojurians | clojure | :thinking_face: interesting! Yeah, I think I remember meeting you at the conference! | 2017-11-18T14:05:12.000098 | Adelina |
clojurians | clojure | Those are some things I definitely hadn't thought about or considered. I was trying to weigh using interop vs using an existing kafka library like clj-kafka. | 2017-11-18T14:11:47.000037 | Adelina |
clojurians | clojure | <@Bettyann> :flag-br: | 2017-11-18T14:38:54.000042 | Lois |
clojurians | clojure | <@Adelina> Have not seem one I’m really happy with, but not doing kafka now, but worked on a java library which wrapped the java clients. I almost used it for a pet project so did some research. Most likely I will use the java client. If I would want to to do something with the stream api, I would probably just use java. | 2017-11-18T14:50:03.000080 | Daine |
clojurians | clojure | teng - `read` takes a stream, you can use it to repeatedly access a stream and get the next form | 2017-11-18T15:15:43.000015 | Margaret |
clojurians | clojure | I haven't used lein in a while and upgraded before I created a new project and am getting errors like this when I try and do `lein deps`: ```Could not transfer artifact enlive:enlive:jar:1.1.6 from/to central (<https://repo1.maven.org/maven2/>): Connect to [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Could not transfer artifact enlive:enlive:jar:1.1.6 from/to clojars (<https://repo.clojars.org/>): Connect to [localhost/127.0.0.1] failed: Connection refused (Connection refused)
``` | 2017-11-18T15:24:48.000045 | Gwendolyn |
clojurians | clojure | Any ideas why it's trying to connect to localhost? | 2017-11-18T15:25:15.000061 | Gwendolyn |
clojurians | clojure | <@Kassie> ```(with-open [rdr (-> "clojure/conduit/src/conduit/status_transmitter.clj"
(io/reader)
(java.io.PushbackReader.))]
(doall
(take-while #(not= ::done %)
(repeatedly #(try (read rdr)
(catch Exception _ ::done))))))```
`((ns conduit.status-transmitter (:require [taoensso.timbre :as timbre] [conduit.kafka :as kafka] [noisesmith.component :as component] [conduit.tools.component-util :as util]) (:import (java.util.concurrent ScheduledThreadPoolExecutor TimeUnit) (java.util Date) (<http://java.net|java.net> InetAddress) (java.lang.management ManagementFactory) (javax.management ObjectName))) (defn get-cpu [] (let [mbs (ManagementFactory/getPlatformMBeanServer) oname (ObjectName/getInstance "java.lang:type=OperatingSystem") ls (.getAttributes mbs oname (into-array ["ProcessCpuLoad"])) usages-raw (map (fn* [p1__249#] (.getValue p1__249#)) ls) usage (map (fn* [p1__250#] (/ (* p1__250# 1000) 10.0)) usages-raw)] usage)) (defn get-all-stacks [] (map (fn*...` | 2017-11-18T15:26:15.000045 | Margaret |
clojurians | clojure | <@Margaret> Wow, that worked! Thank you so much! I was surprised that I couldn’t find this anywhere though :slightly_smiling_face: | 2017-11-18T15:29:05.000023 | Kassie |
clojurians | clojure | ```
(defstyles media
(at-media {:orientation :landscape}
{:html
{:transform "rotate(-90deg)"}}))
(css media)
(comment
@media (orientation: landscape) {
html-transform: rotate(-90deg);
})
@media screen and (min-width: 320px) and (max-width: 767px) and (orientation: landscape) {
html {
transform: rotate(-90deg);
transform-origin: left top;
width: 100vh;
overflow-x: hidden;
position: absolute;
top: 100%;
left: 0;
}
}
```
how do I inject the 'screen and' into the @media part ? | 2017-11-18T15:37:28.000020 | Berry |
clojurians | clojure | found it, {:screen true} | 2017-11-18T15:47:05.000034 | Berry |
clojurians | clojure | any ideas how I can figure out what's going on with my lein? is there a better place to ask? | 2017-11-18T16:07:36.000066 | Gwendolyn |
clojurians | clojure | <@Gwendolyn> There's a <#C0AB48493|leiningen> channel -- but you could try your question since a lot of people here use `lein`... | 2017-11-18T16:29:37.000011 | Daniell |
clojurians | clojure | <@Daniell> Thanks, my question is above <https://clojurians.slack.com/archives/C03S1KBA2/p1511036688000045> I found the lein channel too and posted there as well | 2017-11-18T16:30:28.000076 | Gwendolyn |
clojurians | clojure | Maybe something odd in your `~/.lein/profiles.clj` file? | 2017-11-18T16:34:36.000005 | Daniell |
clojurians | clojure | I deleted my .lein folder to try and fix it | 2017-11-18T16:34:54.000052 | Gwendolyn |
clojurians | clojure | 'k... Do you have any network proxy running or perhaps a firewall that might be messing with things? | 2017-11-18T16:36:00.000051 | Daniell |
clojurians | clojure | nope, I am at home and using a standard ubuntu install | 2017-11-18T16:36:15.000033 | Gwendolyn |
clojurians | clojure | Can you get to those repo URLs in a browser on that machine? | 2017-11-18T16:36:37.000019 | Daniell |
clojurians | clojure | yes | 2017-11-18T16:36:40.000015 | Gwendolyn |
clojurians | clojure | curl and chrome both | 2017-11-18T16:36:46.000039 | Gwendolyn |
clojurians | clojure | `Connect to [localhost/127.0.0.1] failed: Connection refused (Connection refused)` seems unusual to me, but I could be wrong | 2017-11-18T16:37:10.000058 | Gwendolyn |
clojurians | clojure | should it be trying to connect to localhost? | 2017-11-18T16:37:19.000023 | Gwendolyn |
clojurians | clojure | Yeah I've never seen that. | 2017-11-18T16:37:29.000014 | Daniell |
clojurians | clojure | proxy env's are all empty | 2017-11-18T16:39:09.000067 | Gwendolyn |
clojurians | clojure | Did you try `lein repl` outside a project folder? (Just to make sure there's nothing odd in your `project.clj` file) | 2017-11-18T16:40:00.000021 | Daniell |
clojurians | clojure | yes, I did, I tried it from ~/ | 2017-11-18T16:40:12.000025 | Gwendolyn |
clojurians | clojure | I'm out of suggestions at this point, sorry :disappointed: | 2017-11-18T16:46:22.000033 | Daniell |
clojurians | clojure | no problem, thanks | 2017-11-18T16:47:45.000073 | Gwendolyn |
clojurians | clojure | I’m trying to read a json from stdin but I’m having some problems..
I’m using cheshire trying to convert the entry but I’m getting a “JsonEOFException: Unexpected end-of-input”
Does anyone tried to do this? | 2017-11-18T20:43:07.000029 | Audie |
clojurians | clojure | ```(ns job-queue.core
(:gen-class)
(:require
[job-queue.job-queue-handler :as handler]
[cheshire.core :refer :all]))
(defn handle-json
[json]
(prn "json: " json)
(prn "json decoded: " (decode json true)))
(defn -main
[& args]
(println "Hi, enter the JSON!")
(doseq [in (line-seq (java.io.BufferedReader. *in*))]
(handle-json in)))
``` | 2017-11-18T20:43:48.000035 | Audie |
clojurians | clojure | perhaps that’s because stdin is bringing one line at a time? | 2017-11-18T20:45:37.000085 | Audie |
clojurians | clojure | probably, yes | 2017-11-18T20:48:31.000056 | Domingo |
clojurians | clojure | hmm
Is there a way to bring the lines all together? | 2017-11-18T20:48:56.000004 | Audie |
clojurians | clojure | `slurp` is a common way of reading a file into a string | 2017-11-18T20:49:24.000070 | Domingo |
clojurians | clojure | <http://clojuredocs.org/clojure.core/slurp> | 2017-11-18T20:49:41.000007 | Domingo |
clojurians | clojure | I have tried to do with slurp but it doesn’t print anything
```(ns job-queue.core
(:gen-class)
(:require
[job-queue.job-queue-handler :as handler]
[cheshire.core :refer :all]))
(defn handle-json
[json]
(prn "json: " json)
(prn "json decoded: " (decode json true)))
(defn -main
[& args]
(println "Hi, enter the JSON!")
(let [in (slurp *in*)]
(handle-json in)))
``` | 2017-11-18T20:52:56.000013 | Audie |
clojurians | clojure | am I doing something wrong? | 2017-11-18T20:53:27.000007 | Audie |
clojurians | clojure | how are you calling it from the command line? | 2017-11-18T20:59:01.000001 | Domingo |
clojurians | clojure | I’m executing the command ```lein run``` | 2017-11-18T21:00:35.000070 | Audie |
clojurians | clojure | and then pasting a json that is correctly formatted | 2017-11-18T21:01:40.000027 | Audie |
clojurians | clojure | try `echo '"string"' | lein run` | 2017-11-18T21:04:39.000059 | Domingo |
clojurians | clojure | I suspect `slurp` needs and EOF, which it's not getting if you're running just `lein run` and typing | 2017-11-18T21:06:35.000016 | Domingo |
clojurians | clojure | (well, `ctrl-d` will send EOF, but it'll also quit the program. that works for me.) | 2017-11-18T21:07:20.000038 | Domingo |
clojurians | clojure | yeah, if I executes ```echo '"string"' | lein run``` it works | 2017-11-18T21:09:06.000001 | Audie |
clojurians | clojure | well, It’s an exercice and I have more things to do.
I’m going to move on this way | 2017-11-18T21:10:32.000065 | Audie |
clojurians | clojure | thanks a lot <@Domingo> | 2017-11-18T21:10:45.000048 | Audie |
clojurians | clojure | glad to help! | 2017-11-18T21:11:06.000085 | Domingo |
clojurians | clojure | This is a common code pattern I use:
```
(case (:tag obj)
:foo (let [{:keys [a b c]} obj]
...)
:bar (let [{:keys [x y z]} obj]
...)
:cat (let [{:keys [aa dd ff]} obj]
...))
```
Is there a nice macro to simplify this? basically, I want to 1. dispatch on the :tag field, and 2. do a destructuring bind on keys | 2017-11-18T21:41:28.000044 | Berry |
clojurians | clojure | You could just use a multimethod | 2017-11-18T21:45:03.000085 | Sonny |
clojurians | clojure | ```
(defn rule->sexp [obj [[tag & vars] & body]]
`[~tag
(let [{:keys ~(vec vars)} ~obj]
~@body)])
(defmacro tdbind [obj & rules]
(let [obj-var (gensym "obj")]
`(let [~obj-var ~obj]
(case (:tag ~obj-var)
~@(mapcat #(rule->sexp obj-var %) rules)))))
(macroexpand-1
'(tdbind (make some obj)
[[:rect x y]
(* x y)]
[[:circle r]
(* r r 3.14)]
[[:triangle a b c]
(assert false "no idea")]))
(comment
(clojure.core/let
[obj9109 (make some obj)]
(clojure.core/case
(:tag obj9109)
:rect
(clojure.core/let [{:keys [x y]} obj9109] (* x y))
:circle
(clojure.core/let [{:keys [r]} obj9109] (* r r 3.14))
:triangle
(clojure.core/let
[{:keys [a b c]} obj9109]
(assert false "no idea")))))
```
is closer to what . I had in mind :slightly_smiling_face: | 2017-11-18T21:53:24.000065 | Berry |
clojurians | clojure | cross-posting this link here from <#C03RZMDSH|datomic>, would appreciate any help <https://stackoverflow.com/questions/47373356/query-result-pagination-in-datomic> | 2017-11-18T22:24:01.000044 | Ahmad |
clojurians | clojure | What's your way of introducing new bindings as you test some conditions? I see that let bindings in `cond` was rejected.
<https://dev.clojure.org/jira/browse/CLJ-200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel>
<https://github.com/Engelberg/better-cond> | 2017-11-19T03:43:16.000020 | Lesia |
clojurians | clojure | that's to avoid boxing | 2017-11-19T04:52:03.000036 | Kareen |
clojurians | clojure | ah, sorry didn't notice I was this back in the scrollback :) | 2017-11-19T04:53:08.000027 | Kareen |
clojurians | clojure | Hi, how to get the min value's index of a vector? shall i use `(let [v [1 2 3 4]] (.indexOf v (apply min v)))`? | 2017-11-19T04:55:22.000048 | Tari |
clojurians | clojure | you can `(apply min-key v (range (count v)))` | 2017-11-19T05:26:04.000066 | Kareen |
clojurians | clojure | Here’s my try, bit verbose; would the use of reduce make it more or less efficient than using ranges?
```
(let [v [7 2 4 3]]
(reduce-kv
(fn [[min-k min-v] k v]
(if (< v min-v)
[k v]
[min-k min-v]))
[0 (first v)]
v))
``` | 2017-11-19T05:32:16.000070 | Deborah |
clojurians | clojure | (also, doesn’t work correctly for an empty vector but gives you both key and value) | 2017-11-19T05:33:23.000022 | Deborah |
clojurians | clojure | A multimethod would be a lot simpler | 2017-11-19T09:10:20.000055 | Sonny |
clojurians | clojure | (defmulti area :tag)
(defmethod area :rect [{:keys [x y]}] (* x y)) | 2017-11-19T09:12:46.000055 | Sonny |
clojurians | clojure | Etc | 2017-11-19T09:12:57.000051 | Sonny |
clojurians | clojure | Hello everyone. Did anyone of you ever wrote a logging into a clojure application? I am currently building a clojure app with postgresql and one of main features should be activity log.
This feature was actualy designed after i wrote a lot of code, so customizing every database action to also make a activity log would be time counsuming and to be honest not very clean solution. | 2017-11-19T15:48:09.000054 | Logan |
clojurians | clojure | Therefore I am asking if anyone of you know any good clean solution to this? I was thinking about some posgres triggers or stuff like that, but i need to know which user in my application is doing such action | 2017-11-19T15:49:05.000061 | Logan |
clojurians | clojure | realistically, how big can a *.cljc file get before it becomes too big ? | 2017-11-19T18:31:39.000035 | Berry |
clojurians | clojure | <@Berry> depends on who you ask :stuck_out_tongue_winking_eye: | 2017-11-19T18:36:05.000057 | Kristy |
clojurians | clojure | personally I go by these lines in general | 2017-11-19T18:37:09.000116 | Kristy |
clojurians | clojure | Anyone who might help me with my issue :slightly_smiling_face:? | 2017-11-19T18:37:28.000004 | Logan |
clojurians | clojure | > Did anyone of you ever wrote a logging into a clojure application?
I'm confused by the wording | 2017-11-19T18:38:19.000076 | Kristy |
clojurians | clojure | Sorry, i will try to clarify it as much as possible | 2017-11-19T18:38:44.000114 | Logan |
clojurians | clojure | We have appplication where several users perform basic CRUD actions on postgresql database | 2017-11-19T18:39:40.000016 | Logan |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.