Fork me on GitHub
#clojure-europe
<
2021-06-23
>
dharrigan06:06:06

Good Morning Clojurists!

RAMart06:06:20

Second :clojureD 2021 talk now online: "Your own fast, native Clojure scripting CLI with GraalVM and SCI" by @borkdude https://www.youtube.com/watch?v=L2LAaQBVvxM

👏 22
🍻 10
2
gklijs07:06:45

Good morning

pez07:06:50

Morning!

slipset11:06:53

Good morning and such. TIL manqué is in fact an english adjective, meaning >  Having failed to become what one might have been. What a poetic word. Erik Assum, a creator of bugs, a programmer manqué.

pez11:06:27

Thought you said it was an adjective?

pez11:06:24

I’m confused now. Google also gives such an example, and Wikipedia has: > A Manqué is a person who has failed to live up to a specific expectation or ambition. It is usually used in combination with a profession: for example, a career civil servant with political prowess who nonetheless never attained political office might be described as a “politician manqué“.

pez12:06:05

Ah, used postpositively. Now scrambling for an adjective like that in Swedish. Drawing blank.

pez12:06:36

I think we can do it for stylistic effect with about any adjective…

val_waeselynck18:06:34

As an aside: "postpositively" is such a preposterous word

😂 2
slipset20:06:15

One of my favourite Clojure gotchas has been showing up in the logs, stemming from this code:

slipset20:06:10

(apply max l)
Which works nicely except when it doesn’t. l is a list of natural ints, so we can use a wee bit of algebra here, and fix it, since we know that 0 is the identity value for max over natural ints, so we can do:
(apply max (conj l 0))
Of course a colleague of mine pointed me to a much nicer solution:
(reduce max 0 l)
which shows that max, 0, and the natural ints form a monoid, since max is also associative.

🤯 2
vemv07:06:37

> Which works nicely except when it doesn’t. oh TIL :) (or am about to L) in which case it doesn't?

slipset10:06:36

when l is nil

👍 2
slipset10:06:49

Since max isn’t defined for (max)

slipset10:06:49

Which almost brings you into dependent types land if you squint a bit 🙂

vemv10:06:58

a spec a day keeps the dependent away 😄

slipset15:06:02

That’s a hard spec to write, since the spec needs to be written for apply.

borkdude21:06:53

and that works until you don't deal with natural ints ;)

slipset08:06:17

Jup. a safer thing would be to use negative infinity as the identity value.

borkdude08:06:00

ah yes:

user=> (reduce max ##-Inf [1 2 -10 -10M 10M] )
10M

slipset09:06:25

And, of course, max also has a zero value, ##Inf

borkdude09:06:31

in computers this may work, but in math, this is flawed

slipset09:06:47

How so in maths?

borkdude09:06:34

in math you can't treat ##Inf as one value

slipset09:06:56

Well I guess if you go in to talking about which infinities are larger and such, like is #Inf * #Inf > #Inf and such nonsense 🙂

borkdude09:06:03

math would say like Clojure: you can't take the value of a macro, but then for Inf

val_waeselynck22:06:54

Fortunately, on the JVM, relative integers have a smallest element