This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-27
Channels
- # bangalore-clj (2)
- # beginners (41)
- # cider (14)
- # cljs-dev (12)
- # cljsrn (2)
- # clojure (106)
- # clojure-austin (6)
- # clojure-dev (22)
- # clojure-dusseldorf (1)
- # clojure-france (1)
- # clojure-greece (17)
- # clojure-italy (6)
- # clojure-poland (3)
- # clojure-russia (10)
- # clojure-serbia (5)
- # clojure-spec (24)
- # clojure-uk (100)
- # clojurescript (126)
- # cursive (3)
- # data-science (5)
- # datascript (15)
- # datomic (3)
- # defnpodcast (2)
- # dirac (6)
- # emacs (10)
- # fulcro (121)
- # graphql (30)
- # hoplon (7)
- # jobs (2)
- # leiningen (20)
- # off-topic (14)
- # onyx (3)
- # other-languages (13)
- # pedestal (1)
- # perun (2)
- # planck (41)
- # re-frame (16)
- # reagent (6)
- # reitit (5)
- # remote-jobs (3)
- # ring (1)
- # ring-swagger (17)
- # shadow-cljs (137)
- # spacemacs (6)
- # sql (4)
- # uncomplicate (7)
- # unrepl (56)
- # vim (27)
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?
@leira Make it return a 2d vector instead of a 2d lazy seq in the first place? (vec (map-indexed ,,,))
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
@qqq 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.
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
(doto x assert)
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@qqq just wrap all the bindings with if-let, if one of them fails, code will not be called
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?
Probably I can reformulate the question - is there any way to make lein repl
exit on Ctrl+C
?
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?
hello guys
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?
so only i have (deftype X [name]) and id is generated automatically and i able to do something like (.id x) for example
As far as I know, people usually create a constructor function: (defn make-x [name] (X. (generate-id) name))
@p-himik i know this so do you think there is something better ?
for example hiding (generate-id) part
(X. name)
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.
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?
henrik maybe google protobuf
@henrik 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.
Cheers, I could yeah. I’m currently eyeing ØMQ: http://zeromq.org
The introduction is speaking to my Clojurian sensibilities: > 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.
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.
case has a special case for seqs
but that should only be true for lists not vectors... hm
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."
user=> (case ["a" (int -1)] ["a" -1] true false)
false
user=> (case ["a" (long -1)] ["a" -1] true false)
true
user=> (case -1 -1 true false)
true
user=> (case [-1] [-1] true false)
true
user=> (case (int -1) -1 true false)
true
user=> (case [(int 1)] [1] true false)
true
user=> (case [(int -1)] [-1] true false)
false
integers are kind of rare so maybe that's why people don't run into this more often
oh it only happens with vectors containing negative integers
I think that's directed at @ml ? 🙂
@ml, link?
@ml, you could reduce the repro to what @bronsa wrote (`compare` or the 2-element vector don't help trace down the bug)
clojurescript doesn't make a lot of sense as it doesn't distinguish Long vs Int
I don't think I do either
@bronsa 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?
@bronsa I think it is using hasheq?
I realize there are a lot of cases
prep-hashes implicitely assumes that on collision nodes h(h(v)) == h(v) where h = hashing and v = collision test
hmm, subtle
well, that’s a bug then
(case (int -1) -1 true false)
is not doing what is implied right?
oh, that’s in the expr not the case
I read the (int -1) as a case of “int” and “-1", but that’s the expression, so nvm
yeah, I’m sensitized to look for it now :)
I've added a patch for CLJ-2275, pretty straightforward apart from quite a tricky line which I commented on
This SO question came about because the person was re-implementing zipmap
and rolling up their function args with &
instead of just naming them keys and vals. so the first answer says to overcome this by using apply
, I suggested naming the args. Please vote on your preferred solution: https://stackoverflow.com/questions/47517056/how-to-re-implement-zipmap-in-clojure/47518278
lein doo
gives me Exception in thread "main" java.lang.RuntimeException: No such var: string/includes?, compiling:(cljs/util.cljc:157:13)
, followed by a long stacktrace with compiler internals. How do I know which cljs/util.cljs
it refers to? It’s apparently from some dependency, not from my project.
I have a string of length 29. I want to create 10 strings of length 2, by dropping every 3rd char from the string.
Current idea is to convert to a list of chars, and use drop / partition, but I'm wondering if there ar better string functions.
Hi Clojurians. I’m trying to build a simple REST api + clojurescript with re-frame and reagent.. and sass. So I was thinking to use chestnut template for this. Would it be an overkill?
@bravilogy it’s useful to start from scratch but there’s a lot of instant gratification from using chestnut; either approach is fine
Does anyone have any experience using grpc/protobufs from Clojure? I want to use Google Cloud APIs and extract data out of them as persistent maps; I could use the Java API but that means writing a bunch of POJO<=>persistent data structure mapping code that I don’t really need. I guess what I’m saying is: is there a https://github.com/portkey-cloud/aws-clj-sdk for grpc?