Clearly functional programming doesn't work. No big successful company has chosen it

Clearly functional programming doesn't work. No big successful company has chosen it.

There is no reason why you need lambdas in a language.

Attached: anti-lambda.jpg (512x512, 195K)

Functional programming weeds out brainlets. You can't hire a thousand pajeets to shit FP like they can do POO.

Lets abolish state
By passing the entire goddamn program state to each and every function and copying the entire thing just to make a tiny change.

>I have never used FP

>Clearly functional programming doesn't work. the reasons one would choose a functional language simply do not align with the goals of software vendors. software vendors want to churn out as much programs as possible in the shortest timespan. functional programming takes longer, put produces more reliable software.
software vendors, and managers, would rather ship the buggy code and fix the problems with upcoming patches than delay shipping the program.

>There is no reason why you need lambdas in a language.
you don't need lambdas, but they are convenient. ever written a comparison function that you pass to a sorting function? tell me about the time that you reused the same comparison function in multiple places. chances are, you only used it once, and that would have been better suited as an anonymous function (aka. lambda).

Bitch I did a course in FP which I completed with an A.
The techer used this exact solution for every single program.
Although tbf we only ever did Customer Records and shit and only one GUI at the very end.
But we still handed the entire list of all records to all functions and modified it exactly this way

you clearly haven't written a program that actually does something in a functional language.

You did a course in FP, not software engineering. You only need to share the relevant state with a function, and immutability means you can reuse as much of previous data structures as you wish (i.e. structural sharing)

Then how would you do modifications ot a list of customer records (name, adress, etc)?

this.
passing the entire state around is an easy way to get people started in fp, but it's not how it should be done.
it's the same reason why using global variables to introduce someone to programming is fine, but using them everywhere in your program becomes a problem.

Facebook uses Haskell

One way or another you are gonna have lists of things in your programms. And since in FP everythings immutable, you are gonna make copies (unless you use linked lists, which is cheating).

Sure. But structural sharing means you don't have to copy as much data. There's a reason why defensive copying is so pervasive in languages with mutability such as Java, and why immutable data structures are increasingly desirable in those languages.

only the spam filter. I'd rather use assembly than haskell for web devlopment

This thread has been posted with the exact same image, many times before. Must be some kind of big tech shill who wants to keep things OO to undercut our wages.

Basically this.

Yeah I know the haskell compiler optimises it in the background, but just copying modified immutables defeats the entire purpose of functional programming.

Attached: Magic.png (640x400, 193K)

This isn't about Haskell. Immutable data structures in languages with mtuability can take advantage of the techniques I've described.

Twitter uses scala,
soundcloud uses scala and clojure and zalandoo also does

There is nothing wrong with immutable Data structures, and I like the way C++ and Java implement them.
What I have a problem with is FP claiming to be somekind of great alternative when it seams increasingly clear that they are just an abstraction that does the same shit as Java in the background.
I thought the advantage of FP was that there was no state, but since the state is just carried through multiple functions, that just isn't true.

C++ is bad at immutable data structures because it lacks a GC. You can't easily take advantage of structural sharing without a GC.
OOP is so broadly defined that there are indeed flavours of it that resemble FP. But that's not what OOP usually means.
One advantage of pure FP is that state is more explicitly managed, that doesn't mean there is no state.

>C++ is bad at immutable data structures because it lacks a GC
fucking retarded haskell programmers should be put on a boat and deported to india

I bet you use python.

nigga what the fuck is wrong with python? I thought it was the only language this board sort of agreed on.
Sure its fucking slow but you are not gonna write skynet in it,a re you

>I thought it was the only language this board sort of agreed on.
The only language that is not hated on Jow Forums is a language nobody has heard of

ahahaha called it

>he uses the 3rd most popular programming language sometimes haha im fucking nostradamus

fag

To quote Guido, the creator of python:

>Python probably has the reputation of supporting functional programming based on the inclusion of lambda, map, filter and reduce in the language, but in my eyes these are just syntactic sugar, and not the fundamental building blocks that they are in functional languages. [...]You can write reduce() in a few lines of Python. Not so in a functional language.

>You can write reduce() in a few lines of Python. Not so in a functional language.

Really? Here is reduce:

(define (foldl fn init lst)
(if (null? lst)
init
(foldl fn (fn init (car lst)) (cdr lst))))


Four lines of code isn't "a few lines"? Four SIMPLE lines at that, you could easily knock this down to three or less with no reduction in clarity.

Conclusion: Guido is a joke. He doesn't understand functional programming yet he passes judgement against it, and his bias influences the development of Python. It's no wonder then that his bias rubs off on people who use python. Python users come to share Guido's irrational biases against functional programming because Guido built that bias into python.

you sound biased
and butthurt

This is the most unreadable piece of shit I've ever seen.
Code golfing doesn't count

The code speaks for itself. It proves that Guido is a hack.

i think you're just dumb user

That's not code golfed, that's straight forward scheme. Perhaps you prefer this racket code:

(define (foldl fn init lst)
(if (null? lst)
init
(foldl fn (fn init (first lst)) (rest lst))))


Here it is in Elixir:

def foldl(_, v, []), do: v
def foldl(f, v, [x|xs]) do
foldl(f, f.(v, x), xs)
end


Reduce is going to be only a handful of lines of code in any functional language. That's a simple fact, which guido doesn't perceive because he doesn't understand functional programming but nevertheless has strong unfounded opinions about it.

Why not pointer to a function? T. Cnile

you still have to define the function in c. it's not anonymous.

In JS this is just
const foldLeft = (fn, init, list) => list == null ? init : list.reduce(fn, init);

The objective was to implement reduce yourself... Using a reduce function provided by standard libraries isn't the point.

e.g.

const reduce = function(iterable, reduceFn, accumulator){
for(let i of iterable){
accumulator = reduceFn(accumulator, i)
}
return accumulator
}


(Still a few lines, but a reasonable javascript implementation of reduce suffers because you can't rely on TCO)

Shit nigger, here is reduce in C:

int reduce(intFn fn, int size, int *elms)
{
int i, val = *elms;
for (i = 1; i < size; ++i)
val = fn(val, elms[i]);
return val;
}


Even in C reduce is straight forward. Guido's assertion that reduce can't be written in a few lines in a functional language is totally insane. It's so divorced from reality you have to wonder what drugs he was on.

kek

In Haskell this is just
fold f i [] = i
fold f i (x:xs) = f x $ fold f i xs

>no big successful company
Facebook uses erlang
Amazon uses erlang
Whatspp is entirely erlang based
Ericsson invented erlang.
Discord, Pintrest, grindr all use elixir (erlang)

There are many more I can't be fucked to remember.

Exactly. Functional languages like Haskel lend themselves to implementing reduce, but Guido for some reason believes otherwise. It's baffling.

But because Guido is so bizarrely wrong about functional programming, python was made to be hostile to functional programming. The crippled lambda syntax is one example of this. Consequently, python enthusiasts are biased against functional programming because Python does a disservice to it, because Guido has a bizarre bias against it and lets that bias influence his work.

In JS a proper reduce is just
const reduce = (iterable, fn, ...accumulator) => {
if (typeof iterable.length !== "number") {
const it = iterable[Symbol.iterator]();
let i = 0;
let step;
let acc = accumulator.length ? accumulator[0] :
(step = it.next(), step.done) ? void 0 : (++i, step.value);
for (const val of it) {
acc = fn(acc, val, i++);
}
return acc;
}
let i = 0;
const len = iterable.length;
let acc = accumulator.length ? accumulator[0] : len ? (++i, iterable[0]) : void 0;
for (; i < len; ++i) {
acc = fn(acc, iterable[i], i, iterable);
}
return acc;
};

what the fuck I love javascript now!

Well, I like to write python in a functional fashion. It's a little convoluted but it's less unicorn'y than lisps. Nothing against lisps though. I've been procrastinating on learning Clojure.

FP in python is hobbled by the legacy of Guido's ignorance. For instance it's the root of the reason you can't have multi-line lambdas in python.

There is something absolutely so banal about somoene who likes functional programming languages.

C++ literally does everything under the sun the best, and you just have to understand what the fuck you are doing.

People who are not content with c++ are just lazy.

I like C++ (relatively speaking) and use it whenever I'm doing systems programming but to say it's the best at all things is to be comically ignorant.

Implement reduce recursively with C++ without blowing the stack.

Literally show one language that is more performant or has a wider breadth of libraries than c++.

C++ has libraries for everything under the sun and they are all the fastest libraries.

Anyone who doesn't use c++ just doesn't want to put in any hard work.

>implementing anything recursively

Do you want to know how to recurse without blowing up the stack? It's called loops with conditional branches inside.

Literally if you don't code in finite state machines you're an idiot.

>>Do you want to know how to recurse without blowing up the stack? It's called loops with conditional branches inside.
That's not recursion. You said that C++ is literally the best at everything, but I see you're now walking that back and qualifying yourself.

There is more than one way to recurse dumbfuck. Iterative recursion is the most efficient. Recursion with functions is literally just retarded.

>unless you use linked lists, which is cheating
So?

by making changes to a database that stores them

lol

Here's one off the top of my head: Walmart Labs

1st for erlang

Erlang and now Elixir are being used a fucking lot in the industry. Check WhatsApp and Discord for instance.

>fastest
Laughs in fortran
How's that pointer aliasing working for you nerd?

>what is restrict

Get to it then, nigger

> Iterative recursion
Isn't recursion.