Fork me on GitHub
#clojure
<
2017-01-20
>
bcbradley00:01:00

is it possible to leverage client side web sockets in http-kit?

bcbradley00:01:09

or is it server only?

beppu00:01:36

@bcbradley - http-kit is for the server. If you want to talk to a websocket server that happens to be powered by http-kit, see https://www.html5rocks.com/en/tutorials/websockets/basics/

bcbradley00:01:20

@beppu thanks for the advice, I'm actually in the middle of implementing a client library for discord's http api

bcbradley00:01:51

it has a section on websockets, but after looking into http-kit it seems I can't really use it to solve this problem

bcbradley00:01:26

right now i'm looking through http.async.client source on github to figure out if i can use that instead

dominicm08:01:41

@bcbradley there's a slack client which has ws, probably worth looking at :)

prakhar09:01:06

hey folks, is there a channel for quil by any chance?

beppu09:01:47

@prakhar There is a #quil, but there's no recent activity in it.

yenda14:01:10

https://clojure.org/reference/lazy This page says

available in the SVN trunk since rev 1287
, what is this SVN trunk, where can we find it ?

yenda14:01:20

We are confused with this

lazy-cons
the article is talking about, it is not even in the api doc of clojure 1.1, is it a super-outdated article without a date ?

yenda14:01:10

After investigating a bit it looks like this is around 8 years old, it should really be updated since it is the reference article about clojure laziness.

schmee14:01:06

it’s definitely confusing that the 8 year old model is referred to as “the current seq model” in the document

yenda14:01:31

and the page says: published 2017-01-18

placeboza15:01:29

FYI - I see SwiftKey has a version that they wrote with Clojure and Skummet (lean compile)

pyr15:01:43

Say you have a function that may receive a string or bytes

placeboza15:01:11

Apologies if that isn't really news (about SwitftKey Clarity) . Here: https://blog.swiftkey.com/what-makes-clarity-keyboard-tick-clojure/

placeboza15:01:31

exciting cos I wanted to make a keyboard with Clojure as well.. thought it was a bad idea

pyr15:01:06

clojure

(defn f [x] (handle-bytes (if (string? x) (.getBytes x) x)))

pyr15:01:23

how do you resolve the reflection for a case like this

mavbozo15:01:40

@placeboza wow! Microsoft uses Clojure

placeboza16:01:54

@mavbozo Were'd you see that?

mavbozo16:01:49

@placeboza the logo at the bottom http://swiftkey.com website

placeboza16:01:30

Interesting, missed that. Not sure thats what it means though

placeboza16:01:06

Ah.. ok you win

placeboza16:01:08

"TouchType Limited operates as a subsidiary of Microsoft Corporation."

placeboza16:01:28

@mavbozo So it is a subsidiary then

Alex Miller (Clojure team)16:01:40

Microsoft has bought a couple companies that use Clojure. MixRadio is another.

Alex Miller (Clojure team)16:01:17

@yenda pre-Git, Clojure was stored in svn, but that history should still be in the existing git repo. I moved that lazy page over to the current site because some of it still seemed relevant, but it should be treated as a historical document. I will try to make that clearer on there though.

souenzzo16:01:08

Clojure on iOS? SwiftKey has iOS producs.

placeboza16:01:14

I thought MixRadio closed

placeboza16:01:40

There's options for iOS .. lein-fruit might be one

placeboza16:01:07

and there's clojure-scheme

placeboza16:01:31

Im tempted to not really care about iOS

placeboza16:01:36

but there it is

placeboza16:01:03

no idea if they even tried to support iOS for SwiftKey Clarity

bfabry18:01:47

hmm, using transit to serialize very long lists I'm getting "org.msgpack.unpacker.SizeLimitException: Size of array (4236122) over limit at 4194304", am I basically SOL there as that's the max array size for msgpack and transit lists get stored as msgpack arrays? guess I should switch to json?

tbaldridge18:01:00

@bfabry yeah, I think you have to switch to JSON, but to be honest JSON has been just as fast as msgpack most of the time

tbaldridge18:01:35

On some platforms msgpack is actually slower.

bfabry18:01:30

hmmm, I'm guessing not this one, big heavy java workers, but yeah I'm sure json is plenty fast. is its compression good though? we just switched from edn because the size of our serialized data vs the size in memory difference was large enough it was causing worker load estimation issues

tbaldridge18:01:50

EDN doesn't have compression though, Transit does. so things like keywords are written once, then afterwards they are written as '^1'

tbaldridge18:01:23

but give it a try? It's just a matter of changing a single keyword to :json

tbaldridge18:01:30

Although if everything is on the JVM I'd also be tempted to use Fressian. That gives you even more features/performance

bfabry18:01:46

sweet. that should make a difference. although to be honest I'm tempted to just start yelling at google that assuming the serialized data and the heap representation will move together is a silly idea

tbaldridge18:01:40

Fressian is the data format that Datomic uses. It's a lot like Transit, but full binary and a fair bit faster.

tbaldridge18:01:17

It'll do crazy things like write true, false, 4 , 0.0, etc. as single bytes.

bfabry18:01:27

hmmmm. seems like fressian is giving us back ArrayList's where previously we were getting Seqs from edn and transit

Pablo Fernandez18:01:21

I'm getting this error "java.sql.SQLException: No suitable driver found for jdbc:postgresql..." when trying to access the database from Clojure. When installing PostgreSQL, I installed the JDBC driver and I also added [org.postgresql/postgresql "9.4.1212"] to the dependencies with no changes in the error. Any ideas what might be going on?

seancorfield19:01:26

pupeno: What does your db-spec look like and what version of java.jdbc are you using?

Pablo Fernandez19:01:13

My db-spec was wrong 😳 Sorry 😕

seancorfield19:01:32

Cool, glad you figured it out!

bfabry19:01:39

mmmm seems like it likes java types, so will have to add some custom handlers for maps lists and sets

lxsameer20:01:39

what does this exception means exactly ? clojure.lang.ExceptionInfo: Invariant violation in taoensso.sente:?`. Test form: ((fn* [p1__33724#] (satisfies? interfaces/IServerChanAdapter p1__33724#)) web-server-ch-adapter) with failing input: taoensso.sente.server_adapters.immutant.ImmutantServerChanAdapter@f35bcfd`

bfabry20:01:03

huh, json seems a lot faster than msgpack re: transit

tbaldridge20:01:30

@bfabry yep, never underestimate the power of an army of devs optimizing something for a decade.

bfabry20:01:31

does cause some bizarre " java.lang.UnsupportedOperationException: Caller does not own the underlying input stream and should not call close()." in the CI suite though

viesti20:01:26

Hi everyone! I’m toying around with clojure.spec/form, wondering about this:

user> (let [limit 100] (s/form (s/spec #(< % limit))))
(clojure.core/fn [%] (clojure.core/< % limit))

viesti20:01:39

Let’s say that I’d pass the result of s/form around, I’d have to somehow pass the limit used while the spec was created

viesti21:01:21

or is this possibly a bug?

viesti21:01:34

doh, and now I notice that there is a channel for spec 🙂

Alex Miller (Clojure team)21:01:31

I think that’s expected behavior

Alex Miller (Clojure team)21:01:17

but you could get around it by something like (let [limit 100] `(s/form (s/spec #(< % ~limit))))

hiredman21:01:25

because X is a symbol in the second case, and a class object in the first

hiredman21:01:46

and the symbol X evaluates to the Class object with the name bar.X

moxaj21:01:15

@hiredman hmm.. I'm working on a macro which expands to a definterface call. One of the inputs to the macro has an ^X typehint, which is added to a generated symbol with with-meta. But upon evaluation, I get "NoClassDefFoundError: java/lang/X"

hiredman21:01:58

it is complicated, some places metadata is evaluated, and some places it isn't

moxaj21:01:13

I could prefix the symbol with the name of the current ns, but that seems like a band-aid fix

hiredman21:01:34

or just don't use '^' to attach the metadata

moxaj21:01:16

it has to be available at compile time

seancorfield22:01:55

@moxaj Does this help?

bar=> (defmacro foo [x] `(println (meta ~x)))
#'bar/foo
bar=> (foo (with-meta [] {:tag X}))
{:tag bar.X}
(I’m not quite sure what you’re really trying to do but this at least resolves to the bar.X form you seem to want)

moxaj22:01:13

@seancorfield not really 😞. I need to apply the meta (type hint) at compile time to another symbol

moxaj22:01:19

(this smiley seems more disappointed than sad, sorry about that ^^)

fellshard23:01:50

I'm a bit worried nil shows up as the second-highest 😛

fellshard23:01:50

What are these sourced from? Also seeing surprisingly high numbers for 'puppetlabs', e.g.