Fork me on GitHub
#clojure-uk
<
2017-05-11
>
thomas08:05:55

looks like the UK has shutdown... :thinking_face:

thomas08:05:10

good to hear that 🙂

korny08:05:03

we’re just not allowed to discuss the UK due to pre-election mode. 🙂

jonpither08:05:25

Jeremy C wants to nationalise the energy companies, sounds pretty cool

thomas08:05:52

not a bad idea... but I suspect most people don't care enough about details like that.

korny09:05:43

ObClojure - well, sort of - I’ve been quite enjoying coding in es6, mostly as they seem to have taken a bunch of clojure-y features. JavaScript is vastly nicer with lambdas, and especially with destructuring.

korny09:05:16

I’m doing lots of things I used to be only able to do in clojure, like returning a map from a function and destructuring it into variables.

dominicm09:05:25

My eyes never adjusted to the lambda syntax in ES6.

korny09:05:35

function doSomethingWith(elements) {
    const {
        deploymentTimesEl,
        xAxisGroup,
        xGridGroup,
        yAxisGroup,
        tooltip,
    } = elements;

glenjamin09:05:49

the JS destructuring is a bit rubbish though 😞

glenjamin09:05:55

especially with nulls

korny09:05:26

well, everything is rubbish compared to clojure. But compared to Java, or es5, or a bunch of other languages I have to use…

dominicm09:05:28

@korny I mean the new lambda syntax: () -> 10

korny09:05:36

There are some real ugly things though. Map keys are broken:

const foo = new Map();
foo.set([1,2], "whee!");
foo.get([1,2]);   // undefined!

dominicm09:05:07

stored by reference, not by value, I'm guessing

korny09:05:38

Map keys use === for comparison, which doesn’t work for arrays.

dominicm09:05:12

x = [1,2]
=> Array [ 1, 2 ]
y = new Map()
=> Map {  }
y.set(x, 'foo')
=> Map { Array[2]: "foo" }
y.get(x)
=> "foo"
y.get([1,2])
=> undefined

korny09:05:15

yup, because x === x is true, but [1,2] == [1,2] isn’t.

korny09:05:51

also

m = new Map()
Map(0) {}
m.set(1.0, "one")
Map(1) {1 => "one"}
m.get(1)
"one"

korny09:05:14

as 1 === 1.0

korny09:05:58

I think the lambda syntax is a bit strange, but I got used to it pretty quickly. No stranger than Ruby blocks, or Python … well, whatever Python does, I forget

jasonbell09:05:23

morning friends

mccraigmccraig11:05:47

an 'async' implementation which allocates a thread to poll each subscription facepalm picard-facepalm facepalm

mccraigmccraig12:05:21

unfortunately @thomas i currently depend on this lib 😞 looks like i'm going to have to rewrite it with some sensible concurrency primitives

thomas12:05:48

would make sense @mccraigmccraig, but that could be a lot of work 😞

mccraigmccraig12:05:43

i can probably use a lot of message-parsing stuff straight from the java client, but yeah

mccraigmccraig12:05:53

but i have at least one subscription per active user on my APIs, so 10k users>=10GB RAM right now which seems rather unnecessary

mccraigmccraig12:05:18

(a Thread on a 64-bit vm allocates 1MB stack by default)

Rachel Westmacott12:05:45

I heard that there was a good jvm library with some decent concurrency primitives, began with a ‘C’ I think…

mccraigmccraig13:05:22

ooo i know this one, it's on the tip of my tongue @peterwestmacott, 'cl' something...

Rachel Westmacott13:05:40

maybe they heard Rich Hickey say that they were ‘programming in space’ and decided not to worry about how much memory 10k threads use?

thomas13:05:42

you need to tell me more about this library sometime...

minimal13:05:53

pretty sure there’s no ‘cl’ in erlang

jjl13:05:22

erlang isn't a jvm library

minimal13:05:42

oh yeah, trolling fail

jjl13:05:52

there is a 'cl' that runs on the jvm of course, abcl

mccraigmccraig13:05:26

there's no 'cl' in 'lux' either

jjl13:05:38

alias clux=lux

minimal13:05:57

vapour doesn’t have much apart from hot water

Rachel Westmacott13:05:17

it’s the sound you make when you have to use it?

maleghast15:05:00

Am I missing something, or are datomic schema pure data structure(s)? I mean the ones I am looking at look like a vector of maps... I am just wondering if I can "put" my schema in .edn files and de-clutter my code a bit...

dominicm18:05:52

maleghast: check out "conformity"

agile_geek07:05:10

We use conformity (have a 'legacy' in-house method of applying schema migrations we are moving away from gradually). It's really useful if you need to set up test data too.

dominicm08:05:55

My favourite part of conformity is this: https://github.com/rkneufeld/conformity/blob/9064c47894d641df1c6e4bc0f9cab75b10e2b187/src/io/rkn/conformity.clj#L5 though it looks like they fixed it somewhat now

maleghast15:05:14

(Pretty sure I can, just wondering if that's something other people are doing)

mccraigmccraig16:05:59

ooo i think i need an agent - and i can't remember when i last said that

maleghast17:05:57

@mccraigmccraig - That sounds awfully exciting! 🙂

maleghast17:05:10

(I gather that in the end, people don't use them that often. I've never needed one myself)

maleghast17:05:55

(Or have you managed to get someone interested in your book / comic / film script / comedy act to the point that you__ need an agent__ ?)

mccraigmccraig17:05:52

@maleghast not very exciting and it's the clojurey agent rather than the secret or media agent

maleghast17:05:24

Seriously though @mccraigmccraig, what are you doing to use a Clojure Agent?

mccraigmccraig17:05:23

i was using an atom, but the fn i was using to set the value was getting called multiple times and since it was side-effecty (creating my ioc map) it meant multiple lots of db connections etc were getting created

maleghast17:05:10

Oh I see - that's an interesting use-case, and I can see why it would be a good fit. Thanks 🙂