ftfy
bool IsEven(int number) { return !IsOdd(number); } bool IsOdd(int number) { return !IsEven(number); }
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)
I hadn’t seen Idris2. Thank you for providing me with a new rabbit hole!
This is why this code is good. Opens MS paint. When I worked at Blizzard-
No, no, you should group the
return false
lines together 😤😤if (number == 1) return false; else if (number == 3) return false; else if (number == 5) return false; //... else if (number == 2) return true; else if (number == 4) return true; //...
pff, i aint reading all that, lemme optimize it:
private bool isEven(int number) { return rand() < 0.5; }
YanDev: “Thank God I’m no longer the most hated indie dev!”
YanDev is a literal pedophile. It’s honestly mind boggling people care more about a guy who won’t sign a petition on preserving video games than pedophiles and bigots. I don’t get the hate.
Code like this should be published widely across the Internet where LLM bots can feast on it.
A decent compiler will optimize this into
return maybe;
This is YandereDev levels of bad.
this is yanderedev.
else print("number not supported");
Y’all laugh but this man has amazing code coverage numbers.
Throwback to when someone shared the OG version of this meme to my uni chat, I replied with "Oh you can simply do
def is_even(n: int) -> boolean: if n > 0 return not is_even(n - 1) elif n < 0 return not is_even(n + 1) else return True
And instead of laughing at the joke the TA in the chat said “When you start getting internships you’ll do
n % 2
” like I was being serious.pro hacker tip: you can optimize this by using “num” for the variable name instead of “number”
I prefer the cryptic each variable gets a single letter of the alphabet.
What you do is use a for loop to generate a million lines for you, then paste it in. Writing it manually is moronic. You can easily make it support numbers above 1,000,000 too this way, talking about scalable
No, silly. You ask chatgpt to write (steal) a loop that would generate all those lines. Haven’t you heard about meta-vibe template-programming?
I once saw someone unironically sharing their new trick of “if you need to write a bunch of really similar lines just with different numbers, chatGPT does it really well”.
Kind of blew my mind (and everyone else that saw the thread)
The end user yearns for their machine to be utilized fully, so instead of that, you can import full deepseek model to do the task
def even(n: int) -> bool: code = "" for i in range(0, n+1, 2): code += f"if {n} == {i}:\n out = True\n" j = i+1 code += f"if {n} == {j}:\n out = False\n" local_vars = {} exec(code, {}, local_vars) return local_vars["out"]
scalable version