Why aren't you an ascended functional programmer that's moved beyond side effects and mutability?

Why aren't you an ascended functional programmer that's moved beyond side effects and mutability?

Attached: ApplicationFrameHost_2019-01-03_23-34-23.png (737x596, 262K)

Other urls found in this thread:

en.wikipedia.org/wiki/Map_(higher-order_function)
twitter.com/NSFWRedditImage

Because I actually write programs instead of just thinking about them

redpill me on FP and why it hasn't taken off in the industry

It's bullshit being pushed by academia with little practical benefit

yeah what even is the use case? when is it more convenient or applicable to use FP?

OOP is bullshit.

it's easier to write imperative once, but possibly long term maintenance is easier with FP

Functional programming allows cleaner abstractions.

demonstrate

and?

It sort of has. We see a lot of functional features in a lot of languages, hell even Java has gone that way. There's libraries like vert.x and shit.

I think we're seeing a move to systems which are more functional rather than languages used. Consider the dominance of micro services and how folks design their applications where data goes through a several layers which are sort of like functions.

Why is OOP bullshit?

>folks design their applications where data goes through a several layers which are sort of like functions.
that doesnt have anything to do with functional programming

map

You turn thousand line aberrations into hundred line extremely modular code. Debugging a clean, concise and modular code is easy.

nubank, a credit card company, only hires functional programmers and clojure devs and they love this shit. They also offer a very competitive paycheck by brazilian standards (the equivalent of living on a cozy 110k/year usd)
I've been thinking about learning it to apply for a job there. But at the same time I feel like they're gonna bankrupt themselves in the near future.

Attached: 1546499860568.jpg (466x466, 64K)

OOP is modular, that's kind of why it exists, but that's beside the point, what does OOP have to do with FP?

Quantum computing where you have to build custom compilers to deal with ternary logic (as opposed to binary)

If you tried procedural or functional, you would know.

Map is not FP. Even Java has it now.

It is a similar abstraction though as far the idea goes. risign above single language level and looking at system a level a service can be thought of as a function which takes an input and produces an output.

A lazy answer. I haven't used procedural or functional languages (Scala not counting I basically used it as more Java) since finishing school. Professionally I've only used OOP.

Show me how you would implement Dijkstra's algorithm under a FP paradigm.

OOP languages are procedural languages

> paradigm purists
lul

use oop to implement your application structure, use fp to implement pure functions. see for details

no one in this thread can counter this design

Modular means turning a big monolithic piece of code into small functions/procedures. What OOP does is scatter monolithic pieces of code and build gigantic and unintuitive graphs of dependence.

I... alright, I suppose we can argue that computers only really do things procedurally. Where are you going with this though? I can't say that writing OOP code is at all similar to writing procedural code.

But I have, user, and dependently-typed functional programming is the future of software development.

>Modular means turning a big monolithic piece of code into small functions/procedures
you can do that with classes or procedures or any other way of segmenting code

>I can't say that writing OOP code is at all similar to writing procedural code.
It is though
an object method is a procedure with some additional context
You are writing procedural code by writing OOP code, not so if you're writing FP code

Bait but I'll bite.
en.wikipedia.org/wiki/Map_(higher-order_function)

They are imperative, not procedural you retard.

>Dijkstra's algorithm
-- SP.hs -- Dijkstra's Shortest Path Algorithm (c) 2000 by Martin Erwig
module SP (
spTree,spLength,sp, -- shortest paths
dijkstra
) where

import qualified Heap as H
import Graph
import RootPath
expand :: Real b => b -> LPath b -> Context a b -> [H.Heap (LPath b)]
expand d p (_,_,_,s) = map (\(l,v)->H.unit ((v,l+d):p)) s
dijkstra :: Real b => H.Heap (LPath b) -> Graph a b -> LRTree b
dijkstra h g | H.isEmpty h || isEmpty g = []
dijkstra h g =
case match v g of
(Just c,g') -> p:dijkstra (H.mergeAll (h':expand d p c)) g'
(Nothing,g') -> dijkstra h' g'
where (p@((v,d):_),h') = H.splitMin h

spTree :: Real b => Node -> Graph a b -> LRTree b
spTree v = dijkstra (H.unit [(v,0)])
spLength :: Real b => Node -> Node -> Graph a b -> b
spLength s t = getDistance t . spTree s
sp :: Real b => Node -> Node -> Graph a b -> Path
sp s t = map fst . getLPath t . spTree s

nice copy and paste from stackoverflow
wow so intuitive

>you can do that with classes

Except when shit turns into a sardine orgy such that you need Prolog to realize what the fuck is going on.

>They are imperative, not procedural
they're both

It's like your implying that how messy your code is depends on the paradigm you're using and not the ability of the programmer

do you expect FPtards to actually know how to program?

>this is clean and readable code according to FPfags

Show me one example of an intuitive implementation with less than 25 lines. And do you expect me to program something just for you? Who do you think you are? The pope? The queen? Go suck a horse cock, and get AIDS from a nigger, you animal.

>Go suck a horse cock, and get AIDS from a nigger, you animal.
are you 12

I would say a lot of new JS being written is more functional than not.

>It's like your implying that how messy your code is depends on the paradigm you're using and not the ability of the programmer

Show me a 1000+ line project of the OOP language you wish that is not a fucking nightmare. Pro tip: you won't find any.

Using 'map' and 'filter' does not mean you are using functional programming. Functional programming means making all interactions pure, leading to giant piles of shit like .

Literally just read the pseudocode on Wikipedia. I can't imagine how awful it would be to try to explain Djikstra's algorithm to students and showing them this pile of garbage.

Objectively define "nightmare"
I can't show you my projects but I have no trouble keeping track of any large program so long as it has some form of structure regardless of what paradigm it was made with

Seconding this post and adding:
Functional languages lend themselves well to parallel processing, sequence manipulations and symbols manipulation.
Especially with the tons of data which flows through businesses today, in real time, a sequence processing paradigm fits like a glove
Any lisp does these well, and I guess haskell and others can also do a good enough job.

Functional is a spectrum and includes many ideas like immutability, declarative styles, and managing side effects. Immutable collection functions are a part of that.

Many functional libraries and styles are taking root in the JS community.

Because i give a shit about performance

No code is automatically modular. Just because you defined an API to a class doesn't mean you haven't coupled it to anything else, or that nothing is inexorably coupled to it.

Parsers, load balancers, anything that can easily boiled down to doing something with chunked data streams.