this post was submitted on 15 Jul 2025
450 points (94.8% liked)

Programmer Humor

37208 readers
250 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] myotheraccount@lemmy.world 106 points 1 day ago (3 children)

ftfy

bool IsEven(int number) {
  return !IsOdd(number);
}

bool IsOdd(int number) {
  return !IsEven(number);
}
[–] balsoft@lemmy.ml 15 points 1 day ago* (last edited 1 day ago) (1 children)

You kid, but Idris2 documentation literally proposes almost this exact impl: https://idris2.readthedocs.io/en/latest/tutorial/typesfuns.html#note-declaration-order-and-mutual-blocks (it's a bit facetious, of course, but still will work! the actual impl in the language is a lot more boring: https://github.com/idris-lang/Idris2/blob/main/libs/base/Data/Integral.idr)

[–] myotheraccount@lemmy.world 2 points 22 hours ago (1 children)

I hadn't seen Idris2. Thank you for providing me with a new rabbit hole!

[–] balsoft@lemmy.ml 3 points 19 hours ago

I'm glad to tell more people about it. It's really quite amazing (I could write a somewhat complex algorithm and prove some properties about it in a couple afternoons, despite limited formal verification experience) and I'm sure that in 20 odd years the ideas behind it will make it into mainstream languages, just as with ML/Haskell.

load more comments (1 replies)