Why is recursion a meme

why is recursion a meme

what's funny about it

Attached: recursion.jpg (430x285, 24K)

Recursion may look elegant, but it is a lot more inefficient than an iteration implementation.

Unless you have a language with tail call elimination, it's really slow, and will you have a hard limit on the number of iterations dictated by the depth of your stack.

Often it's simpler and more efficient to write an iterative function using a stack data structure than to write a recursive function.

The xzibit meme actually isn't recursive is it?

this board is so boring.

You can make a
yo dog I heard you like xzbit meme so I put a xzvit meme with an xzbit meme in your xzvit meme.

Recursion is a meme bevause if you don't add a exit condition you will end up with a function that has no exit condition which leads to the execution of a function with no exit condition which leads to the execution of a function with no exit condition which leads to the execution of a function with no exit condition which leads to the execution of a function with no exit condition which leads to the execution of a function with no exit condition which leads to the execution of a function with no exit condition which leads to the execution of a function with no exit condition which leads to the execution of a function with no exit condition [...]

this is true most of the time but not always

It is only not inefficient and not a waste of time when the whole language is built around recursion(i.e not a single language used in production) and can optimize tail recursions to a loop.

>he thinks meme=funny

I compared recursion to loop for JS code and recursion was faster.

Attached: meh.jpg (200x200, 9K)

Bullshit.
>tail call

>muh production
Wageslaves who think their job is even remotely relevant are so easy to spot

How can you tail call optimize a recursive function that can call itself multiple times?

Attached: 1493453115456.png (1278x720, 765K)

Not used in production = hobbyist language

Most if not all languages people have heard of are being used somewhere by some company.

>some random company uses this so that means it's good

You're the one who brought up the "production" benchmark.

No I'm not

If I use lisp (language with tail optimization), should I write recursion over iteration?

Then don't butt into someone else's conversation faggot with an irrelevant post.

>implying your reply on a public imageboard is a private conversation
>implying my post wasn't directly related to the topic at hand
Go be dumb somewhere else.

That wasn't my reply.

ok

>argumentum ad populum
What a bugman, seriously.

Bugmen are retards, I am not.

You should write whatever looks and feels the most natural thing to do, in any language, and, if performance later becomes an issue, ONLY THEN rewrite it in an iterative/recursive fashion.

>need function to implement X algorithm
>too lazy to reinvent wheel
>search online for implementation
>find it on Rahul's random personal blog site
>none of the code is aligned properly
>no spaces between any operators/expressions
>"int a,b,c,i,j,k,n,m,w,x,y,z;"
>no comments whatsoever
>uses recursion needlessly
>decide to use it anyway
>stack overflows on any useful sized input
>mfw
>rewrite the thing from scratch with proper spacing, proper variable names, proper comments, and iteration
>it just werks
Why are pajeets like this?

Attached: 11a4ul.jpg (300x255, 51K)

99% of the time, if you have to adapt your code for tail calls, you end up having less legible and longer code than with iterative programming.

Most trading infrastructure is built purely functional because any failure costs millions. Recursion is used in production. Look at Jane Street or DRW.

>why is recursion a meme
>what's funny about it
You won't get it unless you understand the meme first.

This is the biggest fucking meme ever and why we have slow and bloated shit.

You should program with performance in mind. Not as an afterthought. If code appears illegible place comments next to it explaining what it does.

Do not confuse performance with micro optimisation and as always: test and compare.

Performance only becomes an issue when it is already to late.

This 'relevancy' theme you like so much can't be anything but projection. Why do you feel irrelevant man?