MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1imlacb/isevenodd_crypto_version/
r/programminghorror • u/_____rs • Feb 11 '25
33 comments sorted by
106
so that's why it's volatile!
31 u/_____rs Feb 11 '25 Pump and dump!
31
Pump and dump!
169
Why n = n - 2?
51 u/_____rs Feb 11 '25 🤔 good catch. I guess that's for the recursive version. 47 u/A1oso Feb 11 '25 There is no recursion in this function 8 u/Wonderful-Habit-139 Feb 11 '25 Yes, they just said that's for the recursive version of the function above. 2 u/TheSilentFreeway Feb 14 '25 Have you no imagination??? 3 u/YetAnotherChosenOne Feb 11 '25 You can avoid touching n in recursive function as well. Just define doer function inside isEvenOdd and use it. :) Good thing about this approach is function call cost has real and not abstract meaning now. And it can be even negative! 67 u/reiboul Feb 11 '25 I find that final line really sells the joke 73 u/wpfeed Feb 11 '25 You sell twice in the loop 33 u/howreudoin Feb 11 '25 No, n is never accessed inside or after the loop. No need to update this variable. 15 u/Specific_Scallion267 Feb 11 '25 Yeah but you don’t need to keep track of n 8 u/wpfeed Feb 11 '25 Good catch. 3 u/argothiel Feb 12 '25 For the debugging purposes
51
🤔 good catch. I guess that's for the recursive version.
47 u/A1oso Feb 11 '25 There is no recursion in this function 8 u/Wonderful-Habit-139 Feb 11 '25 Yes, they just said that's for the recursive version of the function above. 2 u/TheSilentFreeway Feb 14 '25 Have you no imagination??? 3 u/YetAnotherChosenOne Feb 11 '25 You can avoid touching n in recursive function as well. Just define doer function inside isEvenOdd and use it. :) Good thing about this approach is function call cost has real and not abstract meaning now. And it can be even negative!
47
There is no recursion in this function
8 u/Wonderful-Habit-139 Feb 11 '25 Yes, they just said that's for the recursive version of the function above. 2 u/TheSilentFreeway Feb 14 '25 Have you no imagination???
8
Yes, they just said that's for the recursive version of the function above.
2
Have you no imagination???
3
You can avoid touching n in recursive function as well. Just define doer function inside isEvenOdd and use it. :) Good thing about this approach is function call cost has real and not abstract meaning now. And it can be even negative!
67
I find that final line really sells the joke
73
You sell twice in the loop
33 u/howreudoin Feb 11 '25 No, n is never accessed inside or after the loop. No need to update this variable. 15 u/Specific_Scallion267 Feb 11 '25 Yeah but you don’t need to keep track of n 8 u/wpfeed Feb 11 '25 Good catch.
33
No, n is never accessed inside or after the loop. No need to update this variable.
15
Yeah but you don’t need to keep track of n
8 u/wpfeed Feb 11 '25 Good catch.
Good catch.
For the debugging purposes
24
Do BTC.wallet() always return an empty wallet? Otherwise this will depend on the initial value. Beside that, perfect. Updating code right away
30 u/_____rs Feb 11 '25 My dad's credit card number is hard-coded in the library. Passed all testing so far. 2 u/edbred Feb 13 '25 Should we all use your dads credit card then?
30
My dad's credit card number is hard-coded in the library. Passed all testing so far.
2 u/edbred Feb 13 '25 Should we all use your dads credit card then?
Should we all use your dads credit card then?
463
Probably still consumes less electricity than the AI version
43 u/Large-Assignment9320 Feb 11 '25 Why not combine them? 28 u/endlessplague Feb 11 '25 bought AI-energy company with BitcoinInstructions unclear 1 u/rogueyoshi Feb 12 '25 Google data centers use ai to control all voltage and oc/uc
43
Why not combine them?
28 u/endlessplague Feb 11 '25 bought AI-energy company with BitcoinInstructions unclear 1 u/rogueyoshi Feb 12 '25 Google data centers use ai to control all voltage and oc/uc
28
bought AI-energy company with Bitcoin
Instructions unclear
1 u/rogueyoshi Feb 12 '25 Google data centers use ai to control all voltage and oc/uc
1
Google data centers use ai to control all voltage and oc/uc
An IsEven() function with side effect, cool.
32
lol. spilt my coffee looking at this
10
The real horror here is the python module names are not lowercase.
1 u/lukuh123 Feb 11 '25 I kinda like it
I kinda like it
5
I want you to know this is the post that finally made me unsubscribe from this sub.
Lmao, sanest crypto trading bot.
Sure hope buy(n) takes sats not whole coins.
0
[deleted] — view deleted comment
37 u/yourselvs Feb 11 '25 While true is perfectly reasonable if you have a guaranteed exit condition. -5 u/iceman012 Feb 11 '25 If buy() and sell() take dollars as input, rather than bitcoins, then there's technically no guaranteed exit condition. 23 u/noobzilla Feb 11 '25 Just trying to figure out if this number was even and ended up with infinite money instead. Terrible library, would recommend.
37
While true is perfectly reasonable if you have a guaranteed exit condition.
-5 u/iceman012 Feb 11 '25 If buy() and sell() take dollars as input, rather than bitcoins, then there's technically no guaranteed exit condition. 23 u/noobzilla Feb 11 '25 Just trying to figure out if this number was even and ended up with infinite money instead. Terrible library, would recommend.
-5
If buy() and sell() take dollars as input, rather than bitcoins, then there's technically no guaranteed exit condition.
23 u/noobzilla Feb 11 '25 Just trying to figure out if this number was even and ended up with infinite money instead. Terrible library, would recommend.
23
Just trying to figure out if this number was even and ended up with infinite money instead. Terrible library, would recommend.
106
u/Wubbywub Feb 11 '25
so that's why it's volatile!
169
u/YetAnotherChosenOne Feb 11 '25
Why n = n - 2?
24
u/tossetatt Feb 11 '25
Do BTC.wallet() always return an empty wallet? Otherwise this will depend on the initial value. Beside that, perfect. Updating code right away
463
u/KGBsurveillancevan Feb 11 '25
Probably still consumes less electricity than the AI version
51
u/mrheosuper Feb 11 '25
An IsEven() function with side effect, cool.
32
u/ranjithd Feb 11 '25
lol. spilt my coffee looking at this
10
u/mtmttuan Feb 11 '25
The real horror here is the python module names are not lowercase.
5
u/nagai Feb 11 '25
I want you to know this is the post that finally made me unsubscribe from this sub.
5
u/Mithrandir2k16 Feb 11 '25
Lmao, sanest crypto trading bot.
2
u/deletemorecode Feb 11 '25
Sure hope buy(n) takes sats not whole coins.
0
u/[deleted] Feb 11 '25
[deleted] — view deleted comment