Hacker News new | ask | show | jobs
by bedman12345 253 days ago
Man I hate functional programming so much. Please, to anyone reading this. Don’t waste your time on this stuff. They always try to claim functional code makes things safer and more elegant, but I have never seen that in reality. These ideas seem to produce terrible code first and foremost.
1 comments

Can you provide objective measures for "terrible code" and then examples of what you're describing?
It’s slow. Example: quicksort [] = [] quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater) where lesser = filter (< p) xs greater = filter (>= p) xs

It’s really complicated. Everybody includes lenses https://hackage.haskell.org/package/lens I don’t want to read all that stuff just for imperative syntax.

It’d both slow and hard to read. Compare these two: https://benchmarksgame-team.pages.debian.net/benchmarksgame/... https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

The c examples complexity lies in using SIMD. If you know simd it’s easy. You should know simd, it’s useful. The Haskell example is drivel. Long complicated and in the end hopelessly slow compared to the c example. You could als use simd in Haskell, but then it would just be C with extra steps.

The Haskell looks much better, and I don't even know Haskell.

> If you know simd it’s easy.

Surely "if you know Haskell it's easy" is equally applicable.

> The Haskell looks much better, and I don't even know Haskell

Plain crazy take. The c example uses basic coding to implement some clever maths with special fast instructions. Thehaskell example is just some dumb algo implemented with complicated programming. There is obviously nothing good about that.

You can also look at a c example without simd https://benchmarksgame-team.pages.debian.net/benchmarksgame/... It’s shorter and simpler and faster than the Haskell version. It’s not even close???

> It’s really complicated > hard to read

You did not provide objective measures. You're just providing subjective opinions.

True. My statements are meaningful because of that. The objective measures we could agree on are obvious, so they need not to be stated. The heart of the debate is about the things that are hard to measure. As most things in software engineering. I ignored your question because it is a bad one.
No, your comments are nonsensical without it. You claim things as being inherently hard to read and understand. But this is a matter of one's personal context and experience. There are things that I'd find hard to read that you would not, and vice versa.

Just because you don't like something doesn't make it universally bad.

> You claim things as being inherently hard to read and understand.

I don’t.

> But this is a matter of one's personal context and experience. There are things that I'd find hard to read that you would not, and vice versa.

Obviously.

> Just because you don't like something doesn't make it universally bad.

Not my point.

My claim is that most people who want to be good software engineers can spent their time better than doing functional programming. I’m trying to disprove the opposite claim. That claim being that you’d learn something important from doing it or that functional programming offers something important to the programmer. I’m simply sharing the result of my journey through it so that others don’t have to make the same mistake. If it’s fun to somebody they should of course do it. What upsets me is that I was caught up in this delusion that functional programming is worth spending significant time on.