this post was submitted on 15 Jul 2025
458 points (94.9% liked)

Programmer Humor

37235 readers
11 users here now

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

Rules:

founded 6 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] balsoft@lemmy.ml 11 points 3 days ago* (last edited 3 days ago) (1 children)

I mean, it would be almost this exact thing in almost any language.

fn is_even(n: i64) -> bool {
    n % 2 == 0
}
even n = n `rem` 2 == 0
def is_even(n):
    return n % 2 == 0

etc

[–] vinnymac@lemmy.world 4 points 3 days ago (2 children)

Personal preference, but elixir just strikes a balance that doesn’t make me feel like I’m reading hieroglyphs so I’m actually happy to see it praised.

[–] fushuan@piefed.blahaj.zone 4 points 2 days ago

I would have preferred for the function to be called mod, since it's the modulo operation, which in math is represented with a percentage or "mod". Most programming languages use a percentage because of that, so do a lot of calculators.

[–] balsoft@lemmy.ml 2 points 3 days ago

Yeah, I agree that Elixir is a fine language for some tasks. I personally find the readability somewhat average, but it's very maintainable (due to how it enables clear program structure), the error handling is great, and the lightweight process system is amazing.