workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
I'm trying: ``` (deftask learning-dev [] (comp (repl :port 4001) (watch) (fn [next] (fn [fileset] (require 'clojure.tools.namespace.repl) [clojure.tools.namespace.repl/refresh])))) ``` but I am getting error: ``` java.lang.ClassNotFoundException: clojure.tools.namespace.repl clojure.lang.ExceptionInfo: clojure.tools.namespace.repl ```
2017-11-26T17:28:23.000081
Berry
clojurians
clojure
if you call require inside your function, you can’t compile code for that function that accesses it directly
2017-11-26T17:59:49.000041
Margaret
clojurians
clojure
you need to use resolve or similar
2017-11-26T17:59:56.000049
Margaret
clojurians
clojure
it’s much simpler if you can move the require outside the function and into the top level of the code
2017-11-26T18:00:26.000080
Margaret
clojurians
clojure
<@Margaret>: can you head ovedr to <#C053K90BR|boot> ? I have code via resolve, but it's failing with a different error
2017-11-26T18:05:44.000106
Berry
clojurians
clojure
I know nothing about boot
2017-11-26T18:06:07.000056
Margaret
clojurians
clojure
resolve returns a var, you might need to dereference it and get the actual function? usually that doesn’t matter
2017-11-26T18:06:39.000006
Margaret
clojurians
clojure
``` (deftask learning-dev [] (comp (repl :port 4001) (watch) (fn [next] (fn [fileset] (require 'clojure.tools.namespace.repl) ((resolve 'clojure.tools.namespace.repl/refresh)))))) ``` is what I have, but it's causing prolblems with "set! on non-binding thread"
2017-11-26T18:08:34.000065
Berry
clojurians
clojure
but at this point, I guess it's a boot problem, and not a cloju4re problem
2017-11-26T18:08:44.000003
Berry
clojurians
clojure
yeah, that sounds like some boot stuff
2017-11-26T18:08:49.000048
Margaret
clojurians
clojure
repl/refresh is being called properly, just on a different thread
2017-11-26T18:08:56.000010
Berry
clojurians
clojure
one thing to try could be bound-fn, which creates an fn that will have all your current dynamic bindings when called
2017-11-26T18:17:22.000008
Margaret
clojurians
clojure
eh, I'm just going to have emacs hot key send it to repl :slightly_smiling_face:
2017-11-26T18:25:50.000098
Berry
clojurians
clojure
I implemented a map-indexed-2d, give it a 2d vector, it will spit out a 2d lazy seq with the same shape. But I need to get-in on the result, get-in doesn't apply to lazy seqs. What can I do?
2017-11-26T19:35:06.000015
Krysta
clojurians
clojure
(for [y ys x xs] (f (get-entry x y))) ?
2017-11-26T20:22:06.000067
Berry
clojurians
clojure
<@Krysta> Make it return a 2d vector instead of a 2d lazy seq in the first place? `(vec (map-indexed ,,,))`
2017-11-26T21:02:29.000143
Giovanna
clojurians
clojure
yeah~ thx~
2017-11-26T21:03:34.000019
Krysta
clojurians
clojure
I got the same suggestion in <#C03S1L9DN|clojurescript>, but map-indexed-2d loses laziness~
2017-11-26T21:03:56.000148
Krysta
clojurians
clojure
<@Krysta> `nth`?
2017-11-26T21:51:52.000011
Ernesto
clojurians
clojure
or <https://github.com/clojure/clojure-contrib/blob/a6a92b9b3d2bfd9a56e1e5e9cfba706d1aeeaae5/modules/map-utils/src/main/clojure/clojure/contrib/map_utils.clj#L22> ?
2017-11-26T21:54:10.000108
Ernesto
clojurians
clojure
?
2017-11-26T21:54:33.000050
Ernesto
clojurians
clojure
Thank you <@Dirk>
2017-11-26T22:31:35.000170
Tari
clojurians
clojure
assert returns nil; what is the best way to do an assert that returns obj ? I want to basically "assert this obj is not nil, and return original value" I'm not sure if this is better written as a function or a macro
2017-11-27T02:07:02.000048
Berry
clojurians
clojure
<@Berry> why would you want to do it like that? It seems like an use case for if-let which checks whether some function returns something which is not nil.
2017-11-27T02:45:26.000114
Daine
clojurians
clojure
<@Berry> ``` (defn assert-or-value [x] (assert x) x) ```
2017-11-27T03:06:57.000145
Verna
clojurians
clojure
<@Berry> but it seems there is no sense in such behavior.
2017-11-27T03:07:31.000109
Verna
clojurians
clojure
since this function does not change the output, there is no sense in re-defining the value. I mean, if you write something like this `(let [x (assert-or-value x)])` it will look weird
2017-11-27T03:09:50.000204
Verna
clojurians
clojure
(doto x assert)
2017-11-27T03:22:45.000035
Fe
clojurians
clojure
I have code of the form ``` (let [ ... ] (code)) ``` but (code) will throw a weird exception if one of the top bindings is nil -- in which case, I'd prefer to get an assert exception at the point of binding a nil value, rather than when I use it
2017-11-27T03:32:01.000311
Berry
clojurians
clojure
<@Berry> just wrap all the bindings with if-let, if one of them fails, code will not be called
2017-11-27T05:52:05.000021
Daine
clojurians
clojure
<@Berry> you could use the else clause to log something, so you know where it went wrong
2017-11-27T05:53:13.000204
Daine
clojurians
clojure
I have an irritating issue with Leiningen REPL. Every time I try to close an IDE (IDEA + Cursive) that has started `lein repl` via a bash script, it hangs on `Waiting for process detach`. If I `kill` the REPL process, everything continues as it should have. If instead I press "Cancel" in the IDEA dialog, it doesn't wait, but the REPL process is still there, parentless. Is there anything I can do to make IDEA kill REPL?
2017-11-27T06:14:47.000181
Rogelio
clojurians
clojure
Is anyone working on a Clojure to LLL to Ethereum Virtual Machine bytecode compiler?
2017-11-27T06:38:21.000029
Vickie
clojurians
clojure
LLL isn't precisely a LISP, but it's LISP-like
2017-11-27T06:38:45.000139
Vickie
clojurians
clojure
Probably I can reformulate the question - is there any way to make `lein repl` exit on `Ctrl+C`?
2017-11-27T07:03:25.000366
Rogelio
clojurians
clojure
I want to parse a array of bufferedImage. I need the first three values, modify them and then take the next 3. Currently I use a loop construct, but this tooks really long. Now my idea was to use r/reduce, to speed it up. How could I go through the array, always using three values at once?
2017-11-27T07:08:09.000239
Hermelinda
clojurians
clojure
hello guys
2017-11-27T07:31:13.000260
Mallory
clojurians
clojure
i'm asking about situation which i have (deftype X [id name]) , then i would like to assign id automatically without declare it at (X. id name), is there a good way to do it?
2017-11-27T07:32:18.000531
Mallory
clojurians
clojure
so only i have (deftype X [name]) and id is generated automatically and i able to do something like (.id x) for example
2017-11-27T07:33:10.000067
Mallory
clojurians
clojure
As far as I know, people usually create a constructor function: `(defn make-x [name] (X. (generate-id) name))`
2017-11-27T07:33:29.000451
Rogelio
clojurians
clojure
<@Rogelio> i know this so do you think there is something better ?
2017-11-27T07:34:33.000320
Mallory
clojurians
clojure
Better from what perspective?
2017-11-27T07:34:52.000003
Rogelio
clojurians
clojure
for example hiding (generate-id) part
2017-11-27T07:35:07.000155
Mallory
clojurians
clojure
(X. name)
2017-11-27T07:35:17.000218
Mallory
clojurians
clojure
Well, the constructor function does exactly that, it's just named differently. If you want both the same name and an implicit field, I don't think that's possible.
2017-11-27T07:40:00.000291
Rogelio
clojurians
clojure
I have two different standalone projects that I want to send data between. Both are backend, so no need for websockets. but I want to send data back and forth between the two using Transit. Should I roll my own low-level socket thingie, or should I use something else?
2017-11-27T08:02:55.000231
Nilda
clojurians
clojure
henrik maybe google protobuf
2017-11-27T08:07:52.000417
Mallory
clojurians
clojure
<@Nilda> WebSockets can be still be used in your situation. Check this out: <https://github.com/ptaoussanis/sente> It supports Transit out of the box Other projects linked on that page are pretty good, too. Personally, I use Chord.
2017-11-27T08:14:57.000015
Rogelio
clojurians
clojure
Cheers, I could yeah. I’m currently eyeing ØMQ: <http://zeromq.org|zeromq.org>
2017-11-27T08:34:34.000239
Nilda
clojurians
clojure
The introduction is speaking to my Clojurian sensibilities: &gt; Programming is science dressed up as art because most of us don’t understand the physics of software and it’s rarely, if ever, taught. The physics of software is not algorithms, data structures, languages and abstractions. These are just tools we make, use, throw away. The real physics of software is the physics of people—specifically, our limitations when it comes to complexity, and our desire to work together to solve large problems in pieces. This is the science of programming: make building blocks that people can understand and use easily, and people will work together to solve the very largest problems.
2017-11-27T08:36:29.000227
Nilda
clojurians
clojure
A nice paragraph indeed.
2017-11-27T08:39:26.000167
Rogelio
clojurians
clojure
Hello guys. I'm asking if someone have faced use Kafka from clojure. I have been looking for a client and the most updated client, his last commit was 6 months ago. In theory we have planned use version 1.0 of Kafka. Thanks for advanced.
2017-11-27T09:45:51.000038
Lanie
clojurians
clojure
Interestingly, ClojureScript gives `true`.
2017-11-27T09:52:15.000615
Rogelio
clojurians
clojure
case has a special case for seqs
2017-11-27T09:55:58.000075
Fe
clojurians
clojure
Yeah but it works for positive numbers
2017-11-27T09:56:53.000761
Inga
clojurians
clojure
but that should only be true for lists not vectors... hm
2017-11-27T09:57:08.000238
Fe
clojurians
clojure
Yes, as per the documentation: "Note that since lists are used to group multiple constants that map to the same expression, a vector can be used to match a list if needed."
2017-11-27T09:57:29.000490
Rogelio
clojurians
clojure
`(compare 3 2)` and `1` works; same for `(compare 3 3)` and `0`
2017-11-27T09:57:40.000413
Inga
clojurians
clojure
```user=&gt; (case ["a" (int -1)] ["a" -1] true false) false user=&gt; (case ["a" (long -1)] ["a" -1] true false) true```
2017-11-27T10:02:07.000297
Fe
clojurians
clojure
looks like a bug in clojure
2017-11-27T10:06:18.000421
Kareen
clojurians
clojure
```user=&gt; (case -1 -1 true false) true user=&gt; (case [-1] [-1] true false) true user=&gt; (case (int -1) -1 true false) true user=&gt; (case [(int 1)] [1] true false) true user=&gt; (case [(int -1)] [-1] true false) false```
2017-11-27T10:07:07.000271
Kareen
clojurians
clojure
integers are kind of rare so maybe that's why people don't run into this more often
2017-11-27T10:07:08.000413
Fe
clojurians
clojure
oh it only happens with vectors containing negative integers
2017-11-27T10:08:11.000520
Fe
clojurians
clojure
I have a good idea of why this happens
2017-11-27T10:09:11.000030
Kareen
clojurians
clojure
if you can log this in jira I might have a look this evening
2017-11-27T10:09:28.000645
Kareen
clojurians
clojure
I think that's directed at <@Inga> ? :slightly_smiling_face:
2017-11-27T10:10:18.000477
Fe
clojurians
clojure
anybody willing :)
2017-11-27T10:10:30.000170
Kareen
clojurians
clojure
That drove me crazy :smile: yeah I'll try 1.9 later to confirm if it is still the `case`
2017-11-27T10:12:11.000309
Inga
clojurians
clojure
<@Inga> it is
2017-11-27T10:12:22.000443
Kareen
clojurians
clojure
opened one :slightly_smiling_face:
2017-11-27T10:20:36.000160
Inga
clojurians
clojure
<@Inga>, link?
2017-11-27T10:23:22.000809
Fe
clojurians
clojure
<https://dev.clojure.org/jira/browse/CLJ-2275>
2017-11-27T10:24:06.000779
Inga
clojurians
clojure
<@Inga>, you could reduce the repro to what <@Kareen> wrote (`compare` or the 2-element vector don't help trace down the bug)
2017-11-27T10:27:13.000590
Fe
clojurians
clojure
clojurescript doesn't make a lot of sense as it doesn't distinguish Long vs Int
2017-11-27T10:27:54.000002
Fe
clojurians
clojure
I don't have edit permissions
2017-11-27T10:31:45.000736
Inga
clojurians
clojure
it's ok I'll edit your ticket
2017-11-27T10:32:24.000169
Kareen
clojurians
clojure
ok :slightly_smiling_face:
2017-11-27T10:34:21.000259
Fe
clojurians
clojure
I don't think I do either
2017-11-27T10:34:30.000095
Fe
clojurians
clojure
<@Kareen> Very curious how this could potentially be fixed since `Integer.` and `Long.` have different hash codes? Wouln't the compiler have to generate 2**n different cases for a match on a vector with `n` elements?
2017-11-27T10:37:35.000689
Randee
clojurians
clojure
no
2017-11-27T10:37:47.000625
Kareen
clojurians
clojure
we could switch to hashEq rather than hashCode
2017-11-27T10:37:59.000864
Kareen
clojurians
clojure
which hashes equally for integers and longs
2017-11-27T10:38:09.000823
Kareen
clojurians
clojure
Oh I see. :slightly_smiling_face:
2017-11-27T10:38:19.000582
Randee
clojurians
clojure
<@Kareen> I think it is using hasheq?
2017-11-27T11:04:50.000036
Sonny
clojurians
clojure
it isn't
2017-11-27T11:04:55.000107
Kareen
clojurians
clojure
and it's not as straightforward as s/hashCode/hashEq/ unfortunately
2017-11-27T11:05:16.000233
Kareen
clojurians
clojure
I realize there are a lot of cases
2017-11-27T11:05:33.000328
Sonny
clojurians
clojure
prep-hashes implicitely assumes that on collision nodes h(h(v)) == h(v) where h = hashing and v = collision test
2017-11-27T11:06:04.000787
Kareen
clojurians
clojure
which holds true for hashCode of numbers but not for hashEq
2017-11-27T11:06:24.000882
Kareen
clojurians
clojure
hmm, subtle
2017-11-27T11:06:46.000443
Sonny
clojurians
clojure
yeah
2017-11-27T11:06:49.000796
Kareen
clojurians
clojure
I should have a patch ready in by the end of the day
2017-11-27T11:07:09.000124
Kareen
clojurians
clojure
well, that’s a bug then
2017-11-27T11:07:11.000714
Sonny
clojurians
clojure
yep
2017-11-27T11:07:14.000358
Kareen
clojurians
clojure
`(case (int -1) -1 true false)` is not doing what is implied right?
2017-11-27T11:07:36.000204
Sonny
clojurians
clojure
it is
2017-11-27T11:07:48.000012
Kareen
clojurians
clojure
oh, that’s in the expr not the case
2017-11-27T11:08:03.000782
Sonny
clojurians
clojure
the bug only happens when `case` uses hashing comparison + a collision happens
2017-11-27T11:08:04.000216
Kareen
clojurians
clojure
I read the (int -1) as a case of “int” and “-1", but that’s the expression, so nvm
2017-11-27T11:08:43.000156
Sonny
clojurians
clojure
hah
2017-11-27T11:08:48.000258
Kareen