Good Morning Clojurists!
👋
☕
thanks ! I'll have a look !
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
Good morning
Morning!
Morning
morning
good morning!
morning
Morning
morning
Morning
Morning
maaaaning
Morning!
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é.
Thought you said it was an adjective?
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é“.
Ah, used postpositively. Now scrambling for an adjective like that in Swedish. Drawing blank.
I think we can do it for stylistic effect with about any adjective…
As an aside: "postpositively" is such a preposterous word
One of my favourite Clojure gotchas has been showing up in the logs, stemming from this code:
(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.> Which works nicely except when it doesn’t. oh TIL :) (or am about to L) in which case it doesn't?
when l
is nil
Since max
isn’t defined for (max)
Which almost brings you into dependent types land if you squint a bit 🙂
a spec a day keeps the dependent away 😄
That’s a hard spec to write, since the spec needs to be written for apply.
and that works until you don't deal with natural ints ;)
Jup. a safer thing would be to use negative infinity as the identity value.
ah yes:
user=> (reduce max ##-Inf [1 2 -10 -10M 10M] )
10M
And, of course, max also has a zero value, ##Inf
in computers this may work, but in math, this is flawed
How so in maths?
in math you can't treat ##Inf
as one value
Well I guess if you go in to talking about which infinities are larger and such, like is #Inf * #Inf > #Inf
and such nonsense 🙂
math would say like Clojure: you can't take the value of a macro, but then for Inf
Fortunately, on the JVM, relative integers have a smallest element