Professor shills recursion the whole semester...

>professor shills recursion the whole semester, touting it like its the best thing ever and you should only write your code recursively
>find out today that its considerably worse in terms of performance compared to iteration
i feel cheated

Other urls found in this thread:

twitter.com/sherryken777
twitter.com/NSFWRedditGif

You look cute

You also can't make recursive code multithreaded.

That's a CS degree in a nutshell, especiall where there's not a ton of real-world experience in the faculty.

They tend to shill recursion so hard because it makes them feel smart

All the best CS profs at my uni actually had real world experience developing software. The guy I had for the Intro class where we first learned about recursion worked for Microsoft for ~15 years and then EA for another 5.

The first thing he said during the recursion lecture was "Nine times out of ten recursion is inefficient compared to iteration and either VERY heavily discouraged or outright forbidden in production code. The only thing it's even sorta good for is traversing file systems. Don't be that asshole who writes a bunch of incomprehensible recursive code because they think they're slick cutting down the size of their programs, everyone will hate you for it."

tail recursion u mongoloid

If it's an intro class it's probably taught in something like Python or Java with lolNoTCO

this class is a senior course where its literally just focuses on recursion, and we use functional languages like lisp and standard ML. it's a fucking meme to the highest degree

..and what does the EGL sloot have to do with recursion exactly?

>lisp and standard ML
>2017

Jesus wept.

Tail recursion gets optimized by any competent compiler.

That is also wrong as such. But the constraints are essentially the same as always, you typically want pure functions that can usefully run in parallel for it to be easy and all that.

my uni cs dept uses lisp and it's actually been a pretty great way of learning programming paradigms

How bout dynamic programming? Is that usually worse than iterative solutions too?

You use recursion and induction to prove your algorithm correct, then you translate it into an iterative algorithm for implementation. Or use a language that supports tail call elimination to make the performance a little better.

Stockholm Syndrome, everyone.

>he went to college to learn programming
I feel bad for all of you.

The only reason you should feel cheated is the obvious mental retardation you possess. Read a book about compilers. Recursion is used when the datastructure you are operating over can be described recursively. For example a list, which can be seen as a structure with a head and a tail where the tail is also a head and a tail. Trees and therefore graphs can also be described in a similar way. Recursion allows you to think about your data using a different perspective, ie not simply an iterable structure.

>intro CS
>write a linked list, user

Fuck all else.
The first year CS is bullshit.
Hell, most assistances straight up admitted that they write code that is hard to maintain, so the faculty wouldn't fire them.

>cs is programming.

>Intro to CS II
>spend two thirds of the semester going over all of the exact same basic concepts we did in Intro I, but this time in Java instead of brainlet Python (which we never use again after Intro I, the rest of the curriculum is either Java or C++)
>Here's an IDE that will make you way more efficient at writing Java but I'm not gonna show you how to set it up or use it because fuck you, manually compiling via command line and shitty ass Sublime Text is obviously better
>Last two weeks
>Very quickly go over linked lists but not how or why to use them
>Final project is all shit we never even learned how to do like using external .jar libraries, comparators, complex exception handling, multiple threads and user-input menu structures with complex logic
>Somehow kludge together a working solution by cannibalizing other peoples' examples while geeking out on Adderall for three days straight

Use recursion only for recursive structures. Rule of thumb.

Simple rule to recursion

Tree: Use recursion
Not a tree (linear): Don't use recursion

>you

Fucking THIS

Unfortunately, almost all material that introduces the concept of recursion starts with linear examples like factorial, Fibonacci sequence, palindrome checker and print numbers up to X that are easy to trace through by hand but don't illustrate why recursion is useful and make it seem pointless and unnecessarily hard to implement compared to iteration

recursion is faster than iteration by default in most functional languages, and with TCO its optimized away in Clikes anyway

A rule of thumb regarding linked lists: don't use them at all. They are being taught in intro classes because it's the simplest data structure besides an array. But in real life, even in their best use case (when you need to add and remove elements often) they are usually still worse than resizable arrays, because computers are more complex than intro classes could lead you to believe, and sequential data is better than shit scattered all over the memory.

Yeah, I didn't see the point. It just seemed like an array that was a lot harder to use.

The actual point is that lists are a decent intro exercise and also a good starting point to trees, and you will learn a lot about trees in your algorithms and data structures classes.

I see.

My prof just said it was a good way to practice writing recursive code because apparently that's the Holy Grail of programming.

>using recursion in a non-functional programming language

moronic, t b h

>WHY ISN'T MY INTRODUCTORY CS COURSE TAUGHT IN GLORIOUS HASKALL THE ONE TRUE LANGUAGE???

Thank the hasklel (((programmers)))

ITT: brainlets explaining away their lack of understanding of recursion

It's ok, the world always needs more "coders." Leave the actual computer science to Aryan men.

this fucking whore doesn't have shit on my waifu Ranran

Brainlet alert

How is a (binary-) tree not simpler than a linked list tho. Essentially a one-way linked list with two successors per node.

kek, is recursion a cargo cult of programming?

>It just seemed like an array that was a lot harder to use.
B-B-BRAINLET!

>a foundation of mathematics is a "cargo cult"
brainlets
will they ever learn

>muh SICP

That book got replaced for a reason user.

Professors are usually dumb ideologues. Probably a communist too.

just don't abuse it in languages whose compilers don't perform tail call optimization. recursion is a natural solution to some problems. it would be webdeveloper-level retarded to discard it.

I mean..I guess if you're short on blocks of contiguous memory it's useful but that's pretty rare nowadays unless you're trying to do bleeding-edge shit

because it was too hard for millennial brainlets

it's a natural fit to recursive data structures. your prof sounds like a supreme retard who only writes toy programs in his functional meme language of choice. either that or you're misrepresenting what he actually said.

>implying brainlets can understand pic related

> too hard for millennial brainlets

That's a funny way to say "Lisp is almost never seen except in academia nowadays"

>communism is bad
How much do I want to bet you've never even read Marx? You're just a brainlet who needs his politics fed to him through youtube clips of "Jordan Peterson OWNS libcuck MUST SEE"

Ever notice that the smartest posters on Sup Forums (functional programmers) tend to be left-wing? It's because we seek to understand how things work rather than drawing an arbitrary line in the sand and declaring everything before it just fine

Enjoy your enterprise "coder" job, you mental midget

Or this one.

College is a meme, especially computer science. Everyone competent has left the academic premises long time ago.
Why do you think the professor is working there instead of having a real job at company? He could be making so much more. It's because he is either too incompetent to work in real world or maybe he is a molester. As you know molester can only get away with it in the public sector.

>what is emacs
>what is autocad

"coder" imperative monkeys making "Uber for houseplants" don't understand FP? You don't say.

You're spooked as fuck if you think business languages are good. They're literally meant to address the lowest common denominator to churn out as much bullshit as possible. Private enterprise is the opposite of progress

Nah they just spend a ton of time on recursion in the Intro to CS classes here for some reason despite them being taught in languages where recursion is almost always inefficient.

>a foundation of mathematics is a "cargo cult"
Guess what other profound advancement of science and a foundation of our everyday life is a cargo cult too - PLANES.
I'm not denying its usefulness, like how you don't deny usefulness of planes in the original cargo cult. I'm pointing out how ridiculous it is to revere something as basic as a fucking loop.

>that random Sup Forums inclusion
are you happy now?

>what is emacs
artificially difficult-to-learn shit compared to modern IDEs

>what is AutoCAD
The Microsoft Office of CAD software that only stays the industry standard because of Autodesk acting like Microsoft.

stop posting anytime

With what?

>Lisp is almost never seen except in academia nowadays"
So what? You learn enough lisp for the whole course in the first fucking chapter of sicp. Not even a day of work.
Your first programming language is going to be out of production anyway by the time you get a job.

Functional programmers are stay at home autists with nothing to show for. They are not intelligent people. The most intelligent programmers are usually C++ programmers. Ever wonder why people say C++ is too complicated? Because they are brainlets. If functional programmers were so great, I think at least one person would have made a program that I use on daily basis. As for communism, every single time it has been tried it has resulted in poverty and genocide, with communists only having a no true Scotsman fallacy to defend it. Deal with it, you lost the war on facts, Trump and the capitalist revolution is here to bring peace and prosperity globally.

The 6.00 course, which is taught in Python

>likes trump
Brainlet economic illiterate confirmed

3% GDP growth
1.25 million of welfare
Lowest unemployment since 2000

I've got a raise and two new better jobs since this year, off government assistance and my old crappy job is now using more USA materials. Reality disagrees with you.

>Sup Forums in a thread about recursion
kys propaganda whores

Isn't recursion necessary for some data structures? Are those data structures just not used in the real world?

>))))))
Of course not, Lisp looks like it was designed by retards.

>reading comprehension
>Nine times out of ten recursion is inefficient

Yes there are a few real-world instances where recursion is the best solution but not very often.

it's like saying a can opener is inefficient in 99 out of 100 instances because you rarely eat can food

>would lisp benefit from forced indentation?

> I feel like such a big-brained ni[b][b]a for obfuscating my code and watching people struggle to read it

yeah, I bet this time people won't starve...

Lisp benefits from exclusively using paredit mode and making parens almost the same color as the background so you can hardly see them.

>calls people economic illiterate brainlets
>unironically quotes marx
wew

Recursive solutions aren't always inefficient - algorithms that follow the divide and conquer paradigm (e.g., some of our best sorting algorithms) are usually recursive in nature. Some graph algorithms make sense using recursion as well. Sometimes it's really bad when it explodes exponentially like with fibonacci sequences, but being able to formulate an algorithm recursively is a useful first step towards figuring out overlapping subproblems and devising a dynamic programming based solution.

Sorry about your professor user, sounds like he pushed the recursion part without focusing on how it's used to devise iterative solutions.

Very well explained.

Exactly.

What the teachert was getting at was that recursion IS a useful tool and is necessary to understand, but don't abuse it or get too fixated on it as a universal solution.

The dopest CS meme is to replace recursion and iterate over a stack.

Just wait until you find the fun part where you run out of stack space.

if (thread.contains(polBaiting)) {
return thread.setQuality(0);
}else{
thread.increaseQuality(thread.quality + 1);

}

oshit da curly boi is missin a fren

all my 1000,000 years in the post field coding that for nothing

i have read a part of the manifesto though. If anyone claims theres any wisdom to be found in that schizofrenic rambling piece of self masturbation i would report them for being mentally unstable

> (Me)
>>would lisp benefit from forced indentation?
>implying I'm a retarded pythonista instead of a C-ocksucker

>using a shitlang without even partial tail recursion

>I've never implemented malloc: the post

>wanting to write tail recursive code
nah

I've heard the same. Basically discouraged outside of academia. Same goes for a lot of functional programming.

(((((((LISP)))))))

you learn in cs 101 that all everything that can be computed with recursion can also be computed with iteration and vice versa
please go, brainlet

Recursive data structures and recursive functions are not the same thing.

Who is this cheap whore?

I mean, sometimes it's useful. What if you want to write a simple function, but make it look crazy advanced when you post it on SO? If you use recursion, you can easily stroke your ego while confusing lots of script kiddies.

She's not a whore.
twitter.com/sherryken777
>captcha: london avenue

>shows boobs
>not a who are

Which IDE were you referring to user?

Do not call her a whore.

Except no one thinks C++ is too complicated it just adds a ton of unnecessary things and pretends it's C.

Also your formatting is shit kys.

Yes you can, turn on Intel Hyperthyreading in your BIOS settings

Why not? ̇͜>̇

nice rote-memorization, brainlet, forgot to turn the page where it says "in theory"? it can be very impractical as you need to implement a stack just to translate some recursive solutions to iterative ones

Try to traverse a hierarchical data structure that isn't plain flat, bending over backwards with iteration