[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Why should I learn a functional language?
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 50
Thread images: 3
What benefits does a functional language have that OOP languages don't?

For example, python has functional statements, and java just got lambdas in java 8.

What benefit would there be for me to learn LISP, haskell, etc?

People here seem to hype them up as being what makes you a "real l33t programmer", but I'm convinced its a meme unless you can prove me otherwise.
>>
dude it makes your programmer dick bigger and more upboats on /r/programming
>>
>>54926587
literally the only argument I've found so far.

is there a real-world use for them? outside of hardcore-mathematics professions?
>>
>>54926567
you've clearly haven't done any real programming
>>
>>54926700
'lol you're not one of us, learn haskell faggot'

This argument doesn't convince me.
>>
>>54926567
Don't lump Haskell in with LISP.

Haskell is a toy language that is designed purely to be elegant.

Personally, using LISP gives you an even better understanding of how to use necessary FP structures in langs like Python/C++/Java, etc

I wouldn't say it's a toy language, but more of a teaching language for a certain paradigm. There are few places where FP langs are the primary lang used, in the real world, but their concepts are very largely useful
>>
both make you change the way you see programming. Before you learn either of them you're pretty much using a procedural language and thinking that's the way it is.
Of course, if you only care about the shekel and being a good goy, of languages that'll give you a job, and not at all about becoming a better programmer, then you can happily ignore them.
But if you do think you for some reason want to write better code, then the paradigm shifts can help you write more concise, clean code, and to show you where some approaches might be better than others
But since you mentioned java, I can guess what group you belong to
>>
>>54926914
>using LISP
>LISP
>in CAPS
This is tell-tale sign you are a Lisp noob at best.

Anyway, OP, learn Elm (http://elm-lang.org/). It's super easy and purely functional, so you will have to think functionally to use it.
>>
>>54928029
>he's a noob because he spells it the way he has been spelling it since 1958
O-okay?
>>
>>54926567
Why is there a beetle on the cover
>>
>>54928262
Why is there a whatever on anything of their books
>>
>>54928299
Don't reply to my post ever again
>>
>>54928312
>>54928299
Shit's going down lads
>>
>>54926668
>hardcore-mathematics professions
Retard.
>>
>>54926567
If you are not interested in programming language theory then don't waste your time with pure functional programming.
>>
No, don't learn it,
it's just a meme.

t. Haskell-programmer
>>
>>54926567
>What benefits does a functional language have that OOP languages don't?
None. It's a hobby category of languages not suitable for production.
>For example, python has functional statements, and java just got lambdas in java 8.
Correct. Fully functional is fully autistic. Functional are hobby languages for unemployed neckbeards.
>What benefit would there be for me to learn LISP, haskell, etc?
It's interesting from an academic, theoretical point of view, and it's a nice hobby to have.
>People here seem to hype them up as being what makes you a "real l33t programmer", but I'm convinced its a meme unless you can prove me otherwise.
You are quite right though, it is a meme of sorts, so I can't prove you wrong.
>>
>>54928410
This is what people said about OOP in the early 90s
>>
>>54928299
>>54928312
Don't reply to my post or my son's post ever again.
>>
File: 1413997972331.png (880 KB, 720x720) Image search: [Google]
1413997972331.png
880 KB, 720x720
There's no reason not to use any functional language since they're well optimized to run like any imperative language for most of the tasks, while being much more concise and easy to grasp.
>>
>>54927821
will it improve my programming skills enough to a point where i get a significant raise
>>
>>54926567
>What benefit would there be for me to learn LISP, haskell, etc?
I have never come across a job that requires use of either.
>>
>>54928536
Bullshit. Visual C++ for instance was first released in 1993, and Turbo C++ in 1990. Many people was already using Smalltalk since the late 70s.
Haskell design started in the late 80's, Java on the other hand in the mid 90's.
Pure FP is a meme outside of academy, period.
>>
>>54928790
OOP was barely used outside of academia before Java
>>
>>54928410
>he uses oop despite it being intrinsically anti-parallel and anti-modular
>>
>>54928536
>>54928819
Not at all. OOP started being used in industry with the new graphical workstations and got really big when GUIs went mainstream, but it was still important before then.

When OOP started getting popular, academics needed to invent new techniques to describe objects because they were focused on FP. They were saying FP was the future since before OOP was mainstream.

Have you heard of the papers "The Next 700 Programming Languages," "Correspondence between ALGOL 60 and Church's Lambda-notation," and "Can Programming be Liberated from the Von Neumann Style?"
>>
>>54928819
Sure thing m8, and that's why Borland made a fucking compiler and ide for it... fucking Wolf3D used it! stop spreading lies
>>
OK here's the litmus test: can you people name any great popular usable applications written entirely in Haskell ? And if not ,why not ?
>>
>>54928203
Yes. People who use Lisp and participate in online discussions about it will have their all-caps spelling corrected until they switch to writing it as "Lisp". Those who do not participate in these discussions but have at least read them notice the pattern as well. There may be nothing inherently wrong with writing "LISP" but it is nonetheless a strong sign that someone is a Lisp memer rather than a Lisp user. (Also, the latter usually recommend CL, Scheme or Clojure rather than Lisp in general. One reason is that for ages there have been flame wars as to whether Scheme and Clojure should even be called "Lisps".)
>>
>>54928921
But it certainly wasn't mainstream before the mid 90s

>>54928960
It wasn't mainstream

The point is that OOP existed 20 years as an academic interest before it got popular
>>
>>54929017
xmonad
>>
>>54929062
FP have been around for almost 70 years, please stop
>>
File: troll-face_o_255798.jpg (69 KB, 640x492) Image search: [Google]
troll-face_o_255798.jpg
69 KB, 640x492
>>54929085
epic xd
>>
>>54929104
So? It works well for parallelism which is growing more important. The point isn't that it takes a specific number of years for something to get popular, it's that it can exist for decades before that happens.
>>
>>54929017
Can you name one such Java program?
>>
>>54929017
Pandoc. Not that it's a reason to learn Haskell.
>>54929062
More like late '80s-early '90s.
>>
>>54929174
A bunch of Google's web applications, including the search engine itself early on. Amazon. Minecraft.
>>
>>54929287
>early on
>minecraft which is buggy crap
>>
So I'm practicing functional programming, or rather, trying to program functionally (maybe I'm not doing it right?). I'd like some feedback;
1. Is this code functional in style?
2. Is there a better way to format the line returns and white space to make this more readable?
3. Is this a good solution?
/*
Flattens an array whose elements may be primitives,
arrays or multi-dimensional arrays.
concat can take either primitives or arrays, which helps
make a short solution.
*/
Array.prototype.flatten = function () {

return (
list =>
list.some(e => typeof e === 'object') ?
list.flatten() : list
)
(
this.reduce(
(p, c) => p.concat(c), []
)
);

};

var b = [0, [1], 2, [3], [4, [[5]], [6] ] ];

console.log(b.flatten()); // [0, 1, 2, 3, 4, 5, 6]
>>
>>54929174
All of JetBrains products, with the exception of their Visual Studio plugin:
- IntelliJ
- CLion
- phpStorm
- PyCharm
- WebStorm
- DataGrip
- RubyMine
Oracle's SQL Developer
Backend infrastructure for essentially every major corporation in the world.
>>
>>54929417
That's not one

Dumb Java dev
>>
>>54929417
>great popular usable applications
>those
no
>>
>>54929552
There's literally no non-Pajeet software written in Java

Let's be honest, all the Java shills here are Indians
>>
>>54929810
>Pajeet software
What's your definition of this; any software that makes money? Any software that accomplishes something? Any software not related to masturbating to anime?

Neo4j is the biggest graph database, letting developers model data using graph theory. Java.
Matlab is an essential tool for doing engineering calculations. Java.
Android is objectively the best smartphone OS. Java.

The only reason people fawn over functional programming is because stupid people usually can't figure it out, so there's less bad code written in Haskell as there is in Java (or C++ or python or javascript or any other easy to learn language)
>>
>>54926567
Functional programming is easier to write multi-threaded applications in. It's fantastic for big data as well.
>>
>>54930108
Pretty much this.
>>
>>54930108
No, stateless code is easier to write multithreaded applications in. You can write stateless code in any language, and you should, because stateless code is best code. Functional programming just forces you to do it.
>>
>>54930108
>multithreading
this. traffic light software, phone switchboard software and the stock exchange software make full use of this feature.
You can also hot-swap code with functional languages, thanks to no side effects nor state. This means services won't have any downtime when being updated/patched.
>>
>>54929810
>>>/pol/
>>
>>54929174
literally every Android application
Thread replies: 50
Thread images: 3

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.