If functional programming is so good, why isn't it more popular...

If functional programming is so good, why isn't it more popular? What is so good about it any way that people keep shilling it?

Attached: 3 - Tim3Anw.png (719x968, 798K)

functional programming is really good at a set of problems that can be difficult with traditional languages. but purely functional programming languages make some things difficult that traditional languages are really good at.

Because most people are complete fucking retards.

t. C++ programmer with no interest in functional languages.

>If functional programming is so good
Nobody said that. Please, just please don't fall for haskell meme. If you want to get simple tasks done just use LUA or stupid Pascal instead.

t. another C++ dev

Functional languages are only good at solving hard problems.

Normie's don't like hard things, they just want everything to be easy.

If you can't put two and two together here, then you probably shouldn't be using a functional language.

>Normie's don't like hard things, they just want everything to be easy.
You do realize that important factor in solving problem is to be effective, right?

Shut up pajeet. Go back to your loo where you shit out loads of bloat java code.

Attached: 075.jpg (680x543, 39K)

Rude.
Purely functional languages don't solve anything a procedural language doesn't solve, they just make it easier for mathematicians who otherwise can't use computers because of things like state and side effects, which are too complicated for their little minds.

savage309?

Whats the source of the pic?

"functional" basically means:
- no mutable variable or state
- no side-effects
- code must always generate output

You can program in "functional" style in C, C++, etc. It doesn't need to be a "functional" language.
> no mutable variable or state
Make sure variables are immutable. Don't use pointers. Don't change the value of variables that are already defined.
> no side-effects
Make sure your functions don't modify global variables and existing objects.
> code must always generate output
Functions should always return value.

Pure functional style is mainly used to have error-free and thread-safe code. The main disadvantage of pure functional paradigm is that it restricts the programmer. Also, pure functional paradigm is slower than imperative.

There is no such thing as the "best paradigm". Everything has its own advantages and disadvantages.

My recommendation is to use a language that doesn't have a philosophy like C or C++ and be conscious about your own style/s.

Brooke, Discord roastie trolling Jow Forums.

Functional is good. You can write compact code, form the language to your will and use it how you want. But that is the problem, once you are not alone in writing the software it is hard to read and understand the code.

Difficult to follow the flow of the program, and since people write the code even more different from each other than when they write OO, it is difficult to collaborate with functional. That is the main problem.

I learned haskell because Jow Forums was shilling it so hard. Have to say it, haskell is the language that feels "designed" and not hacked together

Functional programming deters the use of state, and encourages writing routines that take an input, provide an output, are always predictable and have no side effects.
It's much easier to reason about and write tests, and any notion that it is hard is misguided. Purely functional languages introduce complexity as a result of not supporting state, but multi paradigm languages are a great way to get started learning how to use functional principles.

Until you actually want to do while loops or something more complicated than 2+2. Why is LUA more intuitive than Haskell?

Because the tasks that it is good for are not common. And solving common programming tasks in a functional style is not convenient.

because most of programmers fall for video game development meme. hurrr durrr imma develop games in c++ and make bux. then they starve and slave away their lives while a guy with a knowledge in Erlang is making actual money with a third of the effort

Attached: 1527382337373.jpg (184x184, 8K)

>I can't into monads or recursion : The post
There is loops, you just don't know them

>there are loops, you just have to solve a riddle and fuck yourself in the ass with a broomstick every time you want to use them

That looks like a username. Sorry that's not me.

>I want every language to be like python
I'm not even memeing. Haskell At the very least will make you a better programmer

I give 0 fucks about language. I want to solve problem at hand, and I don't want to waste 5 days solving retarded riddles that the language is made of.

This.

You're kidding right? Choosing the right language is the like the most important step. You should choose it based on the problem, platform, usecase etc. You don't go programming everything in one language because it's easy for you

Code, more than in any other industry, is a demonstration of the "worse is better" doctrine.

Forget about functional programming being good, and tell me the shittest language you could use in 2018. Yes. I know you're thinking of Javascript.

Now wind back to 2000 and tell me what's objectively the worst possible language to beat out Perl in the web world. Why hello PHP.

In both cases, we see languages that totally won.

Because when people shill funcprog they're actually shilling their new shit slow interpreted toy language.

Same principle applies with C. It's objectively shit, yet still sees widespread use, and ridiculous amounts of effort have been put towards trying to make it not so shit.

It's not. First of all, it's terrible inefficient.
Have you ever seen how those tards deal with containers?
For example, given a list (vector) of elements, how would a normal developer append a single element?
Of course, they would check if the memory capacity of the container is sufficient and if it is, just append the element.
How would a functional programmer do it? By allocating a new container that has the size of the old container + 1, then by copying over every single element from the old container into the new container and then setting the 1 leftover space to the element they want to append.
Brilliant. Fucking. Stuff.
Some functional programmers, to avoid being so wasteful, even use linked lists - but, well, FUCK, on modern CPUs with caches and all , those are already slow as fuck, so that ends up being even worse.

Honestly, functional programming should ONLY be done in small parts of the program where it makes sense - like in the UI.

There's really no good universal solution for appending to a list, with or without functional programming. Pure functions are a cornerstone of funcprogs and they take advantage of cache and shit in way that OOPers never could.

> what is a monad

Lua was really unintuitive for me, having to loop through pairs/ipairs as the ONLY control structure. I get it now, it has some gotchas like it not counting the non-numerical table entries in your length functions and shit (you pairs loop to count length too)

Also
>1 indexed arr^H^H^H tables

Based

They make programming easier especially in terms of making it easier to write it correctly. And then modify and work with it later.

1) Because people are thinking imperatively.
2) Because implementations of imperative languages typically have better performance in most tasks.

>Gotos make programming easier, especially in terms of making it easier to write it correctly. And then modify and work with it later.

Well nobody ever really escaped GOTO. Some people are even harmfully using it in 2018 without realizing it.

That's not even remotely how we do things.

ITT: people who have never used a functional language discuss functional programming

Yeah and I don't get the arguments for C

>I need C for muh minimal or embedded hardware to perform

Bitch every Bluray player has embedded Java and gets along fine.

> Choosing the right language is the like the most important step.

No. It's about learning good programming techniques and paradigms. Learning Haskell doesn't mean you're now a good programmer. I see a lot of shitty programmers writing Haskell code. And there's a lot of beautiful code written in C even though it is supposed to be primitive.

Functional must be used to strip down a complicated code into smaller functions. Imperative must be used for algorithms and basic tools for efficiency. OOP is used for an elegant message passing.

Using a single paradigm in every code is completely retarded.

Good Haskell programmers know when not to use their language. While the retarded ones are busy writing blogs in medium and boasting how Haskell can solve everything.

Does this constitute a riddle to you?
> for_ [0 .. 2] print
0
1
2
> for [0 .. 2] $ \ i -> putStrLn ("Input number " ++ show i ++ ":") >> getLine
Input number 0:
look
Input number 1:
at
Input number 2:
this
["look","at","this"]

That's what I meant. Choose the right tool for the job

Pic related is the canonical "Hello World" program in Haskell.

This example comes from a book called "Haskell programming from first principle". Also this example is from page 759.

See the problem? Something as "trivial" as putting text on the screen is something most people are expected to learn on their first 20 minutes with a language, while with FP you get to that point perhaps weeks into it.

That's the biggest issue with FP adoption, it requires a lot of theory and study to be able to use it, while with most imperative language you can start working relatively quickly.

Attached: haskell_hello_world.png (353x227, 15K)

>do putStrLn "hello world"

Attached: 1526389838415.jpg (1920x1080, 164K)

And thats why C's "trivial" string handling is objectively the best right?

Holy shit, How can anyone be so retarded? Just write
main = putStrLn "Hello World"

Haskell is designed to be useful in real applications. Hello work is simple not useful.

PHP and JS are weird examples. Both of them are interpreted and have very weak type syntax. Web design has generally been done with interpreted languages since browsers can process them more efficiently. Combine this with a back-end that only needs to read a script as opposed to having a WAR running in a container, and PHP kills compiled languages for its use case.

functional programming in c++

Attached: 1528546935896.png (585x591, 268K)

>printing stuff to a console is simply not useful work