clojure-europe

For people in Europe... or elsewhere... UGT https://indieweb.org/Universal_Greeting_Time
simongray 2021-04-20T06:10:05.215700Z

mornin’

dharrigan 2021-04-20T06:16:41.215900Z

Good Morning!

pez 2021-04-20T06:16:52.216100Z

Good morning!

2021-04-20T07:11:04.216300Z

morning

mccraigmccraig 2021-04-20T07:55:34.216400Z

mawning

raymcdermott 2021-04-20T08:29:56.216600Z

morning

jasonbell 2021-04-20T08:33:21.216800Z

morning

thomas 2021-04-20T08:40:14.217100Z

morning

ordnungswidrig 2021-04-20T08:41:07.218200Z

Bonjour!

thomas 2021-04-20T08:41:41.218800Z

an ex-colleague has asked for a book recommendation regarding an intro into FP. Any suggestions? Not Clojure specific though, I have suggest Eric Normand's book as a started (even though I haven't read it myself).

ordnungswidrig 2021-04-20T08:43:33.219100Z

I ikead “Real World Haskell” if you want to go hard core.

thomas 2021-04-20T08:52:24.220100Z

I suspect these people won't use Haskell as this is Enterprise:tm: stuff... 😉

javahippie 2021-04-20T08:53:57.220800Z

Is SICP too hard? If they are already developers, it should hit some interesting topics, shouldn’t it?

ordnungswidrig 2021-04-20T09:07:09.221300Z

@thomas still it’s a very good introduction into FP I think. SICP of course, too!

borkdude 2021-04-20T09:08:33.222200Z

If the goal is to do Clojure eventually, I personally wouldn't bother with Haskell since it comes with a lot of baggage that isn't very relevant in Clojure. Conceptually separating side effects from pure functions is very useful, but you will learn those concepts with Clojure as well.

ordnungswidrig 2021-04-20T09:08:50.222500Z

true that.

thomas 2021-04-20T09:25:29.223100Z

I think the goal is more FP in general, not Clojure or Haskell.

javahippie 2021-04-20T09:28:34.224700Z

We are all obviously biased here, but I think that Lisp is really a great teaching language for FP. I agree with the introduction of Software Design for Flexibility, you can concentrate on the context without being “distracted” by a static type system.

ordnungswidrig 2021-04-20T09:30:47.225500Z

Different topic: does somebody know a good library for longest/critical path analysis in clojure? (Or java if that helps)

borkdude 2021-04-20T09:52:43.225800Z

what is longest/critical path?

ordnungswidrig 2021-04-20T10:13:37.227200Z

if you have a DAG of nodes, each with a weight. The longest path is the path along the nodes which give the heighest sum.

ordnungswidrig 2021-04-20T10:14:16.228Z

critical path is the path where increasing the node weight increases the weight sum of the longest path.

djm 2021-04-20T10:19:54.230300Z

I haven't read them, but O'Reilly has some "generic" functional programming books - Becoming Functional and Functional Thinking. They might be worth looking at (I think they're both jvm-centric; the latter includes at least some Clojure)

refset 2021-04-20T10:23:12.232300Z

I don't know much about Loom (i.e. not enough to recommend it), but this API looks about right https://cljdoc.org/d/aysylu/loom/1.0.2/api/loom.alg-generic#dijkstra-path

ordnungswidrig 2021-04-20T10:23:59.232600Z

Nice.

borkdude 2021-04-20T10:24:30.233Z

We use a Java lib for these kinds of things, it's called jgrapht and very performant

dominicm 2021-04-21T19:19:30.249600Z

Funnily enough, I tried rewriting an alg moving from loom to jgrapht for performance and it was much worse under jgrapht. I think loom had a particularly good algorithm for doing connected graphs that jgrapht didn't.

ordnungswidrig 2021-04-20T10:27:13.233400Z

I wonder if my DAG size of 60k nodes is off the charts.

2021-04-20T10:30:24.233800Z

that is a fair number of steps

ordnungswidrig 2021-04-20T10:32:00.234700Z

I wonder if the calculating the shortest path is even helpful / sufficient to get the critical path

javahippie 2021-04-20T10:36:06.235100Z

If I remember correctly, both loom and ubergraph have builtin functions for shortest path

ordnungswidrig 2021-04-20T10:37:23.235500Z

they do. will explore and report. See you in a couple of week 😛

👋 3
javahippie 2021-04-20T10:45:11.236Z

Ah, did not see that @taylor.jeremydavid already posted that, sorry!

😄 1
ordnungswidrig 2021-04-20T12:25:01.237300Z

Uhhm, [[:a 1] [:b 2] [:c 3]] => [[:a :b :c] [1 2 3]] … how?

ordnungswidrig 2021-04-20T12:25:31.238100Z

[(map first xxx) (map second xxx)] doesnt sound too tempting

borkdude 2021-04-20T12:25:56.238600Z

The rule of juxt: always use it when possible (juxt #(mapv first %) #(mapv second %))

ordnungswidrig 2021-04-20T12:26:09.238900Z

but this would be double-iterating

ordnungswidrig 2021-04-20T12:26:18.239100Z

maybe doesn’t matter.

plexus 2021-04-20T12:26:28.239300Z

If you're using juxt there then you really should also use partial

borkdude 2021-04-20T12:26:52.239800Z

you can single-iterate with a reduce but this would be more boilerplate. if you go that way, then you absolutely must use transients as well

borkdude 2021-04-20T12:27:02.240100Z

and plexus is right

plexus 2021-04-20T12:27:05.240200Z

(map apply vector c1 c2)

ordnungswidrig 2021-04-20T12:27:25.240500Z

that’s the wrong way round

borkdude 2021-04-20T12:27:32.240700Z

oh yes matrix transposition, apply map vector

plexus 2021-04-20T12:27:45.240800Z

Ah but is it?

plexus 2021-04-20T12:27:58.240900Z

Yeah I think so

borkdude 2021-04-20T12:28:45.241100Z

$ bb -e '(apply mapv vector [[:a 1] [:b 2] [:c 3]])'
[[:a :b :c] [1 2 3]]

ordnungswidrig 2021-04-20T12:29:00.241400Z

aaahm

ordnungswidrig 2021-04-20T12:29:01.241600Z

oh

plexus 2021-04-20T12:29:27.241700Z

Ah yes I did have it the wrong way round :)