Fork me on GitHub
#clojure-uk
<
2018-01-25
>
thomas08:01:44

moin moin from the 🚋

yogidevbear08:01:05

Morning. We seem to have blue skies again ☀️

otfrom08:01:01

looks like it will be ☀️ in Dundee this morning

thomas09:01:24

hmmm sounds like I need to move to blighty if I want nice weather 😉

Rachel Westmacott10:01:15

Has anyone ever had memory leak issues with loop/recur?

Rachel Westmacott10:01:05

I’ve got some long running loop/recurs, and I’m wondering about rewriting them as whiles or something. I’m currently watching the memory usage climb and waiting for an OOM Error.

bronsa10:01:56

while is just a macro over loop/recur

bronsa10:01:06

and loop/recur don’t memory leak, whatever you’re doing in your loop might be leaking

Rachel Westmacott10:01:29

hmmm… can’t see it. (yet)

maleghast10:01:43

Hmmm… No sun over here in the West, but at least the snow and the melt-floods are all behind us now… 😉

maleghast10:01:53

Morning Everyone 🙂

Rachel Westmacott10:01:57

I’ve managed to crash JVisualVM with an OOM Error now… 😞

otfrom11:01:14

@maleghast you will live in rainy and dramatic Scotland

otfrom11:01:22

sunny, but a a bit less dramatic this way

maleghast11:01:48

Yeah, there is a level of natural grandeur that we are paying for with this bad weather, @otfrom 😉

thomas12:01:33

CLojure question..... I have a map where one of the values is a keyword... and based on that keyword I want to call a certain function.... keyword and function name happen to be the same ( ie. :connect has to call (connect ...) what is the best way to do this?

thomas12:01:34

I had at first a cond for each keyword... but then I thought why not turn the keyword in to a symbol and call that... but that doesn't quite work unfortunately.

Sam H12:01:37

this will return the function associated with the keyword:

(-> :keyword name symbol resolve)
how did you try and do it?

sundarj12:01:53

probably best to have another map from keyword to fn

thomas12:01:49

ooh.. I like that.

thomas13:01:39

thank you @sundarj that seems to do the trick... and it is a one liner... (and a map with 15 entries)

sundarj13:01:15

great! 🙂

Rachel Westmacott16:01:01

TIL case does not work with functions as the expression/test-constants

bronsa16:01:02

case only works with constants

Rachel Westmacott16:01:11

Are functions not constant?

bronsa16:01:06

no, you can’t embed a function as a constant object

Rachel Westmacott16:01:11

“They must be compile-time literals” according to docs

Rachel Westmacott16:01:31

what do you mean by “a constant object” here?

bronsa16:01:52

what the docstring you cited says, I was just using different words