Fork me on GitHub
#clojure
<
2018-10-31
>
cvic13:10:09

yes, but no code available except https://github.com/nakkaya/ferret Oh well...

zilti14:10:45

NodeJS? Bleh...

cvic14:10:54

Yeah. Js is ugly, but gets stuff done.

zilti14:10:38

Well, Clojure is beautiful and gets stuff done 😛

zilti14:10:19

But hey, there's a lot of hipsters out there who convince management that V8/NodeJS is "faster and more lightweight" than the JVM

mpenet14:10:13

they still use clojure it seems: https://news.ycombinator.com/item?id=18346043

👍 24
taylor16:10:05

for those that don't want to click link: >I wrote and deployed (to production) some Clojure code at Netflix just yesterday. Among other things at Netflix the Mantis Query Language (MQL an SQL for streaming data) which ferries around approximately 2 trillion events every day for operational analysis (SPS alerting, quality of experience metrics, debugging production, etc) is written entirely in Clojure. >This runs in nearly every critical service, ~3000 ASGs and easily > 100k servers and Clojure allows us to also compile it for our NodeJS services as well.

seancorfield16:10:19

I think there's a lot of Clojure running out there but folks just don't write about it as a matter of course -- it all goes smoothly and without drama and folks are just too busy getting s* done.

☝️ 28
lwhorton14:11:05

i’ve always thought this to be the case, too. i wonder how we could prove it?

seancorfield16:10:41

I blogged a lot about Clojure when I got started. Recently, not so much. Clojure evolves slowly, it's stable, it "just works". I haven't felt the need to blog about stuff much lately.

jwhitlark21:10:45

I agree, although I think Kubernetes has some very interesting and positive implications for clojure.

jwhitlark21:10:27

I'm always reminded of those old Bently? ads, "Move along youngster, you'll know when you're ready."

csm17:10:43

so I have a coll of maps I want to dedupe by a key in each map; I was going to just copy clojure.core/distinct and introduce an arg f to dedupe by, and call it distinct-by. Am I missing something by going this route? Meaning, is there a better built-in approach?

csm17:10:12

(distinct-by :foo [{:foo :bar} {:foo :baz} {:foo :bar}]) => ({:foo :bar} {:foo :baz})

noisesmith17:10:39

you could copy the distinct code and use sorted-set-by to create the initial value for the internal accumulator

hiredman17:10:05

you just use a normal set

hiredman17:10:27

you just need the value of the by-fn in the set

johnj18:10:08

@zilti I think in many cases it less about the VM and more about the ecosystem (libs, docs, etc..)

zilti18:10:31

The ecosystem is hardly something where the JLM is lacking though

johnj18:10:36

spending most of your time doing interop is not fun

sparkofreason19:10:18

Is there a way in clojure to create a java class with a typed field? Adding type metadata to the field in defrecord doesn't do anything unless it's a primitive type.

andy.fingerhut19:10:00

I believe except for some primitive types, no. It is recommended to use Java to create a class with full control over the options.

sparkofreason20:10:58

Is there a reason for this?

hiredman20:10:16

it does do something

andy.fingerhut20:10:32

A reason that Clojure doesn't provide all the knobs for class creation that Java does? I think because it would be a lot of work to implement all of those knobs in Clojure, and the Java compiler is right there.

👍 4
narendraj906:11:24

And this work cannot be re-used in ClojureScript.

hiredman20:10:55

usage of the field in the body of an inline extend type or implementing the interface will see the effect of the type hint

sparkofreason20:10:00

I just need to specify the type of the field for interop purposes, and not have it just be Object.

hiredman20:10:12

what kind of interop requires a field type?

dpsutton20:10:51

this sounds like java interop with clojure? not clojure interop with java?

sparkofreason20:10:29

Yes, java wants to inject something based on an annotation.

hiredman20:10:12

I am pretty sure the type hint syntax doesn't do annotations anyway

hiredman20:10:16

last I checked this was a special syntax used in some places that extends the basic type hint syntax, but the general type hint syntax used everywhere doesn't include it

hiredman20:10:21

we are both confused in different ways

hiredman20:10:00

it is correct that type hints don't support annotations, but that is because they aren't part of the type hint but just generally part of metadata attached to a field

sparkofreason20:10:14

This will put the RInject annotation on the redisson field, but the type is Object. Verified by examining the generated class file.

hiredman20:10:38

the :tag ... part is the type hint, the other part (which is used as an annotation) is "other stuff in the metadata map"

sparkofreason20:10:14

Yes, sorry, misread your earlier point.

hiredman20:10:59

that is kind of a shame

Alex Miller (Clojure team)20:10:46

Is it? It would break a lot of the untyped assumptions in the map interface records implement

hiredman20:10:44

it would, but it also makes annotations on record fields a lot less useful

hiredman20:10:21

(not that I have ever had to use such a thing)

hiredman20:10:43

deftypes don't implement the map interface, so in theory they should be fine, the tricky thing is, because defrecord is built on deftype, ensuring that the underlying machinery respects the hints for deftypes, and just uses Object for defrecord

sparkofreason22:10:14

This turns out to be an odd case, because the Java framework I'm using (Redisson) has a bug in their logic that checks if the field designated for injection can be assigned an object of type RedissonClient. Obviously that should work fine for an field of type Object, but they got the arguments switched.