pls help me debug this it stops after 1000 lines
Ape Out Shirt $21.68 |
Tip Your Landlord Shirt $21.68 |
Ape Out Shirt $21.68 |
pls help me debug this it stops after 1000 lines
Ape Out Shirt $21.68 |
Tip Your Landlord Shirt $21.68 |
Ape Out Shirt $21.68 |
just use a while loop homie lol lmao
>not using recursion everywhere so that everyone has to acknowledge your gigabrain
Lmao moron
>watches lain once
>learns lisp
>studies cs and learns real languages
>uses recursion everywhere so that everyone has to acknowledge your brainrot
using recursion is always a midwit's choice, considering some problems are really hard to write down in a for loop
Recursive functions are good if you're trying to do stuff like
where you have some horrible object/dict you want to traverse.
is just a moron
no they aren't, they're always inferior in every single way, you either pay for them at runtime or at compile time, all because you were too lazy to write a while loop and your own stack
The compiler will optimise that out. Python can't but still it's sometimes nicer to write than a bunch of nested while loops
>compile time is not important!
ok midwit you clearly never did anything important
shitty performance and stack isn't very big so you're solving fizzbuzzer problems if you never hit the limit
time is not important!
It's literally not. Chromium takes hours to compile and that's one of the most important software projects on the planet.
Expensive compile time can be solved with compiler caches (ccache, sccache, etc) and throwing more hardware at the problem.
my prediction for incoming low IQ take left me speechless because if it could go any lower it might wrap around to infinity and that basically doesn't happen in math, see https://www.youtube.com/watch?v=rHIkrotSwcc
ok, compute me a factorial of 6 gorillion without TCO unrolling it into a vectorized for loop
i don't think you read what i said, O(n) is not "computationally hard"
It doesn't have to be computationally hard, you clearly don't understand how computers work.
computationally hard problems have shallow stacks; if they did not have shallow stacks they would not finish
you need to read my 2 posts:
1 -
2 -
google translate if you have to
also traversing a tree isn't very computationally hard, that's about one of the only places I can think of where recursion is easier to understand AND has a shallow stack requirement by design.
a beautiful thing in cs is that trees show up everywhere
also:
>In computational complexity theory, a computational hardness assumption is the hypothesis that a particular problem cannot be solved efficiently (where efficiently typically means "in polynomial time"). It is not known how to prove (unconditional) hardness for essentially any useful problem.
it seems like academiagays once again prove that they don't understand efficiency in real machines and have to yap with their muh le academic quotes about irrelevant things
>doesnt understand term
>doesnt google it
>uses it incorrectly
>keeps arguing
many such cases
yes I'm not going to google something irrelevant just because you don't understand why allocating stack frames every time you multiply two numbers isn't a good idea, moron
>shitty performance and stack isn't very big so you're solving fizzbuzzer problems if you never hit the limit
devils advocate here, but (computationally) harder problems have shallow stacks, e.g. N-Queens will never hit the stack limit
>all because you were too lazy to write a while loop and your own stack
and? what's wrong with utilizing the stack already given to me?
nothing, but if only you knew how beautiful things could really be
hello sir
you need to set bigger recursion depth
>No TCO
Lmao shitlang
Would that even work here? A static analyzer sees unbounded recursion that can only stop if print() throws an error. You get TCO in lower languages with the optimizer turned on, but only if you code that error condition explicitly.
int repeat_indefinitely() {
int result = puts("and they don't stop coming");
if (result != EOF) return repeat_indefinitely();
else return result;
}
*and they don't stop cooming
You’re overflowing the stack (max recursion depth). Python doesn’t have a tail call optimization like a functional language does, so it can’t infinitely do recursion like this. If you want to add more depth, read about this:
https://docs.python.org/3/library/sys.html#sys.setrecursionlimit
according to IQfy, C is functional now
C is what I want it to be. If that's not the case for you, you simply got filtered.
Based and C pilled.
>"nooooo c doesn't do x so it can't be y!"
>uses meme language with x and y, and also a runtime implementing x and y and written in c
C has no guaranteed TCO imperative. The Linux kernel uses computed goto which is a GCC compiler extension.
Cultist brainlet.
moron reading comprehension
"Functional implies TCO. TCO. Therefore functional."
You are guilty of
https://en.wikipedia.org/wiki/Affirming_the_consequent
And C doesn't guarantee TCO. It's just available as a compiler optimization in the most commonly used implementations.
yes yes I don't care about your low IQ cope, the only relevant compilers implement it for obvious reasons, just look at this vectorized beauty: https://godbolt.org/z/sraxW1qf7
>-O3
Black person that's what
said.
he said that C compilers don't generate it, because C compilers suck, it's funny how with C++ I get both based abstractions AND good optimizations, C++ chads can't keep winning!
your stack is too small.
Typical troony programmer. Recursion is not made for that. Use a while loop like a real man.
Increasing the recursion limit: Python has a default maximum recursion depth of 1000. If a function exceeds this limit, it can be increased using the sys. setrecursionlimit(n) function
import sys
print(sys.getrecursionlimit())
sys.setrecursionlimit(1500)
but b***h pls just use a loop
>but b***h pls just use a loop
With good languages, the compiler/transpiler/interpreter will do this without you having to write an ugly loop.
this is your brain on lisp
def repeat_infinitely() -> None:
print("Black folk tongue my anus")
repeat_indefinitely()
repeat_indefinitely()
while 1: print("Black folk tongue my anus")
Do this with a more complex use case now...
stop being unclear, give me a use case
Business logic that does stuff on an item, let's say the item can have a parent and so on, at a certain step if a condition is met, you'll need to do same for the parent if it exists.
that problem has a recursive structure, monkey man
return an objects type, check its parent if it has no type:
def recurse(obj):
return recurse(obj.parent) if not obj.type else obj.type
def foo(obj):
while not obj.type: obj = obj.parent
return obj.type
Good languages do this on purpose because when some pootard accidentally writes a recursive function without even realising it you do actually want it to stop/crash at some point.
loops are not always the answer, recursion is more powerful.
>recursion is not always the answer, goto is more powerful
pick the tool for the job moron, calling print() infinitely is a loops job
No one is writing Ackerman's function in a project.
they're both equally powerful. look up the Church-Turing thesis
Why the frick wouldn't you use a while loop
>not returning from your function, just calling it again from inside itself
Absolute clown. There would be an error at the end of those prints but you cropped it out because you're a fricking clown.
hehe, indians practice open defecation on a large scale...
>repeat_infinitely()
Are people really this mentally disabled that they need extra hardcoded functions that do literally nothing but calling a while loop? Are pythoners really THIS stupid? Is this the future of programming languages? Getting rid of barebone structures and replace it with dumbed down functions?
Forth doesn't have this problem.
last should be
I'm not confused at all, you just don't seem to understand why stack isn't meant for your academia bullshit
what academia bullshit? when did i say stack was needed? i was the one person who did iterative (not recursive) dp for day 12
why are you trying to save face on an anonymous imageboard? just close the tab
keep posting more academia bullshit then pretending you didn't, recursion is for Black folk, and I'm a white man, sorry that's just how this world works
you can also hammer in a nail with a brick, doesn't mean you'd actually do it
so point to the post 🙂
you can find it somewhere in
if you look hard enough, you should probably stick to posting only there from now on
i accept your apology
also add my matrix b***h boy @w2wymjrx:private.coffee
>you can also hammer in a nail with a brick, doesn't mean you'd actually do it
If you have no better tool.
Recursion is just a tool.
It can be used badly, it can be used properly. But sometimes it is the best tool to use.
If you run it in Safari it will run forever
Oops I thought this was JS at a glance, PyPy might optimize this
this is a tech support thread and probably a bait/flamewar thread
>he doesn't know what a stack is
You have to go back.