You can only use one

You can only use one.

Attached: vtyzyfnj35uz.png (1047x484, 46K)

Other urls found in this thread:

tetas-perfectas.com/las-razones-de-porque-vox-ha-ganado-tantos-votos/
twitter.com/NSFWRedditGif

Retards value complexity, geniuses value simplicity. Terry said so.

I choose simple and basic recursive calls.

recursion is so easy to read
so tail recursion so no blowing the stack

i feel retarded when i try to make recursive functions

youre mom is blowing my stack

it's because they're like black magic and you overthink them

Although recursive functions are easier to read and and write, if you need to do something incredibly intensive and long, then it isn't the best tool for the job. In that case, it would be better to use loops and counters to keep track of where you are.

It's all about the end product after all

>recursion
>complex
Are you retarded?

It's complex relative to iteration based loops

I never liked how you have to include so many arguments when using a recursive approach.

This

Attached: 78647AE1-B9D0-44AB-8811-676DE0A59058.jpg (184x184, 9K)

Ok, Jow Forums, here's a challenge: show me an actual example of production code that *must* absolutely use either loops or recursion and *can not* just stick to iterators or similar.

If you had to spend more than 3 seconds thinking - then you're wasting your time, your code is pretty trivial and you're here wasting your time arguing about nothing.

Otherwise - optimize for whatever is more expensive, so use recursion for the code that's read often enough by lots of people, and iteration - for the stuff that gotta go fast and close to the optimal performance. This if the language you're using is not shit and has TCO, otherwise either stick to the latter like the brainlet you are or switch languages.

recursive SQL queries

how

what the fuck

wha...

Out fucking skilled

Where is Terry now.

Iterators, because iterators are implemented using loops.

Attached: 1555087148914.png (500x522, 133K)

t'was a good one m8

Attached: american-psycho-bateman.jpg (590x322, 212K)

glow niggers got him

In the heaven with the Lord Almighty.
Where you are? Rotting on an anonymous imageboard.

Evaluating a mathematical expression like 1+2*3.

Ded.

How dude??

I think I expressed myself badly; I meant actual example of production code *that you yourself wrote*. Whatever, fuck me

kinda language dependent, though. In any case - it matters little to you as the interface user, as you end up being able to map a function over a collection or to fold it without thinking about iterations.

The MUL operation on the modern x86 processors just hides its innards from you, so for what you as an ASM programmer might care it's just a slightly costlier operation.

your mom is my mom, brother

>The MUL operation on the modern x86 processors
the fuck
I'm not asking you to implement multiplication using addition
I'm asking you to process the string "1+2*3" and get 7 as a result.

It seems he actually reached a higher plane of counsciousness so what's your problem?

What devilry is this

Attached: 1558299937840.jpg (700x719, 63K)

don't bother, he's a nigger who has never written a compiler

My problem is that his followers didn't follow suit.

use loops to implement recursion now I have both woosh

Attached: 1558236002481.jpg (588x391, 88K)

It takes time to reach Nirvana

Is it gasaffelstein or gasaffelstain?

He programmed so well that God had to take him so he can see his skills in person

Just throw yourself under a train.

That's just normal suicide, it doesn't work as intended if you don't achieve enlightment first.

Doesn't hurt to try.

But it's... hmm... you do have a point though.

the left one approaches a 0.5 loop when the limit of loops approches infinite

you shut your whore mouth

well, that's not what you asked, since you literally said
> evaluating a mathematical expression like 1+2*3
and not
> process a string like x and get y as a result
Which is why I thought about the actual multiplication at the ASM level.

However, a string is still a collection, so you still can use an C++-like iterator to read it. Parsing it, though, is slightly tougher - but with some stretch you can still write a simple LR parser by only using iterators.

The thing is that ALGOL and subsequently C had no iterator concept at all, initially - you had to write a `while` loop yourself and check for the pointer not to be null, which is more error-prone than a simple foreach/map/fold/whatever simply by the virtue of having more moving parts. But nowadays one can write a surprising amount of shit without ever resorting to any actual loops whatsoever.

I've been programming in a lisp dialect for 2+ years, and wrote a loop maybe 2 or 3 times. Python is not that different either - you can solve most of the everyday shit you need with list comprehension/iterators.

I will not respond to your next post because you are literally retarded but parsing the string is easy - the actual part that requires recursion is going through the result of parsing in the right order.

nigger I didn't say
> you can't do it with loops/recursion
I said
> you can totally do it *without* loops/recursion

Godlike

Better avoid the risk of having nestedness spin out of control, which seems to be the bane of modern programs performance
>js

What in the actual fuck

Fucking legendary. Is this a mod or sometihng?
Fucking incredible though.

Attached: 1541980266456.jpg (768x1024, 70K)

for fucks sake source

Still your mom bro

Glorious recursion confirmed as superior.

>worrying about mutable state that can be affected by any number of items is less complex than pure recursion
lol?

sauce us nigger

tetas-perfectas.com/las-razones-de-porque-vox-ha-ganado-tantos-votos/

I did too but after a week of forcing myself through Haskell I got the hang of it

based

Attached: 1522212130209.gif (480x360, 1.98M)

That's a bad example. You can use a binary tree or a stack to solve this. You can argue that recursion use an implicit stack but that prove that loops are equivalent to recursion expression.

Attached: 1529321218346.png (439x452, 72K)

This is the second time in my life I witness this kind of magic

Jack talking to you.

Attached: 1558707161673.webm (512x360, 1.6M)

wait wtf how did u know what your post id would be

got em boi

Go drink some bleach, shit for brains.

this is a rookie mentality
CPS can optimize closures way better than SSA
you can also rewrite basic and simple loops to basic and simple recursions

>Scripting for (you)s
>Not even dubs
7/10

The loop. Always the loop.
Recursion is complete garbage that requires a huge stack to even work properly and even then is limited. Everything a recursion can do, a simple buffer + loop can do better. Don't bring up the fucking Ackermann function, that shit is useless.

The best thing a compiler can do to a recursive function is tail call elimination - aka turning the recursive call into a for loop.
Whoop dee fucking doo. It's almost as if that's the better form in every way, from performance to memory use to program stability.

Fucking delusional recursitards LOVE being at the mercy of whether the compiler is going to notice and optimize the tail call or not. Fucking pathetic.
Yes, there are cases where a recursive function is easier to read and in those cases and if it's either not performance critical or you have looked at your compiler's output and verified that it's tail call optimized, go for it. Otherwise, don't. It doesn't make you smart, it makes you a fucking idiot who thinks they're clever for reading unreadable code that also performs worse - the shittiest kind of programmer there is.

someone didn't attend that one class in the uni where they explained the recursion and now is mad, huh?

Recursion: a function that calls itself from within itself. I can't think of many uses for it beyond for the sake of it.

Attached: okay....gif (300x300, 3.89M)

A beginner mistake is to follow the execution in your head. Maybe do that for one function, after that think more in variants and invariants and just write it like a mathematical formula, trust in the compiler to do its job correctly.

Personally I prefer queries to avoid iterating over data at all. For complex traversal I obviously use loops. Recursion only really works for depth first traversal.

Use a wrapper object

lol

Are you a Wizard?

Attached: 1s1lv785.wizardchan.what_the_fuck_am_i_scryin.jpg (668x691, 147K)

Recursive is often easier to write and understand, but can nearly always be rewritten in an iterative fashion that is more efficient, albeit harder to understand.

I'd say write easy to understand code first, make sure it works, then optimize it.

>recursive is easier to understand
In what world is recursive easier for anyone but functional programmers?

In a world where people study CS.

Many mathematical formulas are defined in a recursive way. Also trees.

Attached: 606bfdf21e6a04707d88b23679605a9c27ab76cd5dcea76d703d2e71b83c17cf.png (500x430, 39K)

Look at the recursive definition for the Fibonacci sequence versus the nth-term definition and you will change your mind

well the good news is that you never have to do them, ever.

Recursive solutions are always outclassed by their iterative counterparts.

nani