627
you are viewing a single comment's thread
view the rest of the comments
[-] uranibaba@lemmy.world 12 points 3 days ago

I would love to see the implementaion.

[-] edinbruh@feddit.it 18 points 2 days ago* (last edited 2 days ago)

The implementation is not very exciting, I capture a variable in python. It could have been done more cleanly.

1000041934

The proof is this. But, I could have made mistakes, it was many years ago.

1000041935

Note that in python you'll never be able to run is_even(5) the stack cannot handle it

Edit: daaaamn, that variable is ugly as hell. I would never do things like that now.

[-] boonhet@sopuli.xyz 1 points 23 hours ago

That's , uh...

Yeah. Cooler than anything I could've achieved for purposefully bad is_even

My first idea of a purposefully bad is_even is this:

def is_even(i):
    return True if i == 0 else not is_even(abs(i)-1)

But I'm sure I could come up with worse given enough time.

[-] edinbruh@feddit.it 1 points 22 hours ago* (last edited 22 hours ago)

That's also slower than most of the stuff you could come up with, it is so slow that there is no hyperoperation fast enough to describe it. There were other approaches that were almost worse though, like "the function is a switch-case that returns false by default. As complaint tickets are opened, more cases get added to the switch-case"

[-] boonhet@sopuli.xyz 1 points 20 hours ago

the function is a switch-case that returns false by default. As complaint tickets are opened, more cases get added to the switch-case”

Oh if that is acceptable, then my secondary idea of using an API call for this should work too. I thought that it would have to be guaranteed to be correct (as long as you don't reach a stack overflow or something)

load more comments (3 replies)
load more comments (3 replies)
this post was submitted on 13 Dec 2025
627 points (100.0% liked)

Programmer Humor

27864 readers
1032 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS