This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-09
Channels
- # beginners (55)
- # boot (173)
- # clara (3)
- # cljs-dev (10)
- # cljsjs (3)
- # clojars (11)
- # clojure (110)
- # clojure-austin (5)
- # clojure-berlin (13)
- # clojure-chicago (2)
- # clojure-dusseldorf (3)
- # clojure-france (24)
- # clojure-italy (4)
- # clojure-portugal (1)
- # clojure-russia (60)
- # clojure-serbia (8)
- # clojure-spec (150)
- # clojure-uk (129)
- # clojurescript (87)
- # core-logic (1)
- # cursive (75)
- # datavis (1)
- # datomic (75)
- # devcards (4)
- # dirac (17)
- # emacs (50)
- # events (2)
- # hoplon (9)
- # jobs (4)
- # jobs-discuss (37)
- # lein-figwheel (3)
- # luminus (5)
- # off-topic (54)
- # om (9)
- # om-next (5)
- # onyx (10)
- # perun (11)
- # protorepl (11)
- # quil (2)
- # rdf (2)
- # re-frame (14)
- # reagent (58)
- # ring (13)
- # ring-swagger (10)
- # rum (52)
- # spacemacs (8)
- # test-check (10)
- # untangled (17)
- # yada (34)
@eslachance Your let
doesn't wrap the lower case
So I can't do a let
within a case?
It should be running d/transact!
At the end of the line that says d/transact!
Which is where I expect it to be
so this is "if the type is presence_update, define newpacket and use it"
"if the packet is this_other_one, define another var and use it"
no... it's... correct.
you can see ]
at the end of the second-to-last line
God! Sorry
Yep! That was me being blind, I added the let after making the case 😄
This whole thing is so ridiculous and it's because this API sends packets that have too many inconsistencies. Bit frustrating
I’ve got a very weird problem doing one of the 4clojure exercises, hope some of you fine folks can help me
(It’s the one where I got to return the intersection of two sets without actually using intersection
)
Filter, clojure.set/select and contains? seem to work just fine when I call them individually, i.e. (clojure.set/select #(= 0 %) #{0 1 2})
returns #{0}
as expected.
And (contains? #{1 2 3} 0)
returns false and (contains? #{1 2 3} 1)
gives me true, which is all fine.
But when I try to use the contains?
method as a predicate, it seems to just always return true
i.e., the function (fn [s1 s2] clojure.set/select #(contains? s2 %) s1)
I wrote which I thought should do the trick simply returns s1
I find this a very weird behaviour, given the individual components seem to do exactly what I expect them to do. There’s gotta be something trivial I’m missing here, but I cannot find it
If your function is actually just as written, it will always return s1
The function body consists of a sequence of three forms. The first two evaluate to function values, and the last is the return value.
probably 🙂
Okay so it just thinks I give it a bunch of functions for fun without doing anything with it
np, this is one of those areas where, when coming from another language, one might be used to getting a syntax error, but clojure doesn’t care
Exactly… many languages have the last as return value, but only clojure gets me confused in what I actually use in a call. Thank you so much!
Ok so... earlier today I almost had to eat my socks because I was having a discussion with people in Discord about programming languages (started by someone claiming "nodejs was more efficient that java because paypal uses it"). Now, I was talking about how Clojure is super awesome at math and was laughing at javascript for claiming that 0.1+0.2 == 0.3
was false... so I ran (+ 0.1 0.2)
in the REPL expecting to show them a screenshot and to my greatest surprise... lo and behold the result is actually 0.30000000000000004
. So I have to ask... What, Why?
@eslachance look into why doubles suck for precision. Java has BigDecimals to allow for precision when you want it.
Oh for a moment there I thought you were adding millions together
@eslachance of course, js doesn't even have the option to do all this. JVM owns node.js in performance on anything remotely CPU intensive. Also worth noting that clojure can get better performance than node.js does with IO through things like manifold. Not forgetting that we can allocate buffers in the kernel for 0-copy network transfers (so fast!). And of course, we can do all this in many threads, not just one.
Well I won the argument on the sole basis that running 100,000,000 iterations of a recursive fibonnaci function of 50 depth was consistently 10x faster in clojure than in was in javascript
21 seconds versus 2.0 seconds
And I've seen how aleph.http can be blazing fast to retrieve from an API over http get. It didn't even seem like it was doing any HTTP stuff so fast it was
I'm building a library to create bots for Discord, and I've already gotten a couple of people interested in "upgrading" from node to Clojure
Dithcord will be a stepping stone.
@eslachance aleph is netty. I believe that this is the secret behind the speed: The kernel allocates the network card the buffer to read into. Then the kernel gives us a pointer at that buffer, and allows us to read it. No copying! Traditionally you'd have a few copies from buffer to buffer.
Also I'm using DataScript for temporary storage of data which is amazing too
All these tools are great.