Functional programming advocates in a nutshell
-
-
@cartman82 I didn't even make it past the second sentence before I wanted to vomit. Though that might just be the stench of foam rubber (see Status Thread for details).
-
Every single application I know is basically just performing data transformation.
Two sentences later...
This does not hold true for IO
-
@cartman82 said in Functional programming advocates in a nutshell:
Does he realize that a lot of programming already follows this (extremely vague) pattern?
Literally any code that's like
def function(input1, input2): [code that only manipulates input1 and input2] return output
is functional programming, without having to introduce weird-ass syntax. We already teach people to reduce problems to small, self-contained functions and reduce dependencies as much as possible.
-
@thegoryone said in Functional programming advocates in a nutshell:
That more or less sums up your entire post
It more or less sums up 99.asmany9sasyouwant % of everything on the Internet.
-
Can we put them in a nutshell?
-
-
Relevant item from my quote file:
edwardkmett: Most monad tutorials are written by people who barely understand monads, if at all, but unfortunately nothing can stop someone from writing a monad tutorial. We've tried, there was blood everywhere.
It applies here with a couple of modifications:
:s/monad/functional programming/g :s/tutorial/advocacy article/g
-
@antiquarian I have tried numerous times to understand monads, and they've all ended the same way: with my brains dribbling out of my ears.
-
@RaceProUK said in Functional programming advocates in a nutshell:
with my brains dribbling out of my ears.
That's actually a pretty good start. XD
-
@antiquarian Thing is, I used to be that way with CPS: tried for two years to understand it, to no avail. Then I started working on SockBot, and within just a couple of weeks, I suddenly understood CPS. Maybe I can do the same trick with monads...
-
-
@asdf no, it's characters per second
-
@asdf said in Functional programming advocates in a nutshell:
@RaceProUK said in Functional programming advocates in a nutshell:
CPS
Canine paw syndrome?
Continuation-passing style.
-
@RaceProUK said in Functional programming advocates in a nutshell:
Continuation-passing style.
Ah, that. It's ugly, but not that hard once you looked at a few examples.
-
@coldandtired said in Functional programming advocates in a nutshell:
Every single application I know is basically just performing data transformation.
I hereby promote Commander Obvious to the rank of Captain.
-
The problem with functional languages is that they took a relatively easy problem, and created hyper-specialized tools to deal with that specific problem. Yes, they're elegant and concise and what have you. Because the underlying problem was easy. "Data transformation", where you have a set of inputs and have to convert them to outputs and not care about anything else, is simple. It's managing state that's the difficult problem. Creating an interactive application that has to keep running and behave differently as conditions change. Which functional programming bounds up in monads, so the complexity of the real world won't pollute their beautiful design, which is why they're the difficult bit in functional programming.
-
@Kian You do know that Haskell isn't the only functional programming language, right?
-
@RaceProUK said in Functional programming advocates in a nutshell:
@antiquarian I have tried numerous times to understand monads, and they've all ended the same way: with my brains dribbling out of my ears.
Numerous times I've gone through the tutorials, read the CS theory, did my exercises. I felt like, yes, I did it! I've mastered monads! I can finally achieve functional programming nirvana everyone's talking about!
Next morning, ask me about it and I couldn't even tell you what monads are.
-
@antiquarian Yes, I know. Haskell is the most extreme example I know of, but they all resort to similar cludges, depending on how "pure" they try to be. The more pure they are, the more specialized they become, the uglier the way to deal with external state becomes.
-
@asdf said in Functional programming advocates in a nutshell:
It's ugly, but not that hard once you looked at a few examples.
Proper coroutines make that style a heck of a lot nicer (as you can then make the continuation just resume the coroutine where you left off). Alas, they're fairly rare; I'm not sure if even C# supports them in enough depth (without lots of complicated nested yields).
-
Where is the WTF?
This seems to be one of the more reasonable articles about functional programming.
It outlines where functional programming is the right tool (input-output programs like web applications, compilers) and where it is a wrong approach (interactive, stateful, IO operations).
Usually such blogs declare their proposed method as the solution to all the world's problems. But this one acknowledges the limitations and promotes using the right tool for the job.The style and terminology is poor indeed, and the article does not say anything interesting. Its not WTF, just unremarkable.
-
@Kian What do you think of Clojure and STM?
-
Kind of surprising to see an avatar like that on an article about functional programming.
(Mobtalker mod for Minecraft, the anime girl representing the creeper enemy)
-
Linked at the bottom was this article, which spends many, many more words than it needs to
-
“The best way to choose what to keep and what to throw away is to take each item in one’s hand and ask: ‘Does this spark joy?’ If it does, keep it. If not, dispose of it. This is not only the simplest but also the most accurate yardstick by which to judge.”
None of the code in my codebase sparks any joy, except maybe for that fringe Excel importer I wrote where everything is done with lambdas.
That's not a very good advice.
-
@Maciejasjmj It's just as useless in real life, unless asthmatics get a rush from their inhalers.
-
@Maciejasjmj said in Functional programming advocates in a nutshell:
None of the code in my codebase sparks any joy
Some of the code I deal with sparks joy. Mostly when I fbmac it into oblivion.
-
This post is deleted!
-
@RaceProUK said in Functional programming advocates in a nutshell:
@antiquarian I have tried numerous times to understand monads, and they've all ended the same way: with my brains dribbling out of my ears.
I'll assume that Monads are the open source C# version of Gonads.
-
@RaceProUK said in Functional programming advocates in a nutshell:
@antiquarian I have tried numerous times to understand monads, and they've all ended the same way: with my brains dribbling out of my ears.
Don't know if you've already seen it or not, but this series might help:
-
@anonymous234 said in Functional programming advocates in a nutshell:
Literally any code that's like
def function(input1, input2): [code that only manipulates input1 and input2] return output
is functional programming, without having to introduce weird-ass syntax. We already teach people to reduce problems to small, self-contained functions and reduce dependencies as much as possible.
I thought one didn't actually have functional programming until they started having functions that take one or more functions as arguments and return another function (just like one doesn't actually have object-oriented programming until one starts having virtual methods).
-
@Medinoc said in Functional programming advocates in a nutshell:
I thought one didn't actually have functional programming until they started having functions that take one or more functions as arguments and return another function (just like one doesn't actually have object-oriented programming until one starts having virtual methods).
Strictly, no. It's just that FP people really like using higher-order functions and OO people really like using virtual methods.