Why does academia push functional programming so hard when it has no real-world use, Sup Forums?

Why does academia push functional programming so hard when it has no real-world use, Sup Forums?

Other urls found in this thread:

delivery.acm.org/10.1145/1190000/1189288/p24-adl-tabatabai.pdf?ip=140.103.52.162&id=1189288&acc=OPEN&key=1D8E1CA5B8D7D8DD.C7439B0D3DAFB569.4D4702B0C3E38B35.6D218144511F3437&CFID=858340262&CFTOKEN=72018567&__acm__=1477673999_a3a2bf37c0a8c45e6570badd66b4eaa6
twitter.com/SFWRedditVideos

it helps open your eyes to different abstractions when you're forced to use only functional programming.

This may be useful later when working with multi-paradigm languages.

>academia push functional programming
They don't.

Well businesses certainly aren't, user.

>if you learn functional, it may be useful when working with languages that have functional features

No shit!

Does it?

I know that Berkeley was teaching SICP around early 2000s when my friend graduated. I never ran across it, but then OOP was "the thing" when I was in school.

It's my understanding that SICP and Lisp captures the fundamentals of computation in a way that's very eye-opening. Even if you don't use it, it probably changes the way you think about problems. Sort of like taking Calculus. I don't knowingly use Calculus in my life, but it certainly changed the way I think about things.

>no real-world use
Pajeet, go back to your cubicle.

>le pajiit meeeem XDDDDDDDD
It's time to stop posting, user.

Yep, it's time to get back to work and rewrite that pajeet-produced JS mess into glorious and reliable PureScript.

>he doesn't realize javascript is functional

Researchers themselves may find functional programming more interesting to use themselves, but I would say "pushing" is a bit strong. If anything, Academia often has to bow to the whims and trends of industry. I don't know if most universities with a research-oriented computer science program would ever willingly teach C# unless they felt some pressure from students to teach what the dominant industry in their city/region hires for.

Basically what said.

My university taught its own spin on SICP as an intro course, because Lisp gets you thinking in a way that closely mirrors how the math of computation works. But the next semester they throw you into the weeds of C, because C mirrors how computers themselves work. It was a really nice contrast, but these days I think they do the first semester in Python? Kids these days.

Anyhow, even after the one-two punch in the gut of Lisp and C, the rest of the curriculum didn't focus much on languages. There was a 50/50 divide between classes that required a specific language (e.g. requiring C for Operating Systems or Networking), or a completely open "Anything but Perl" policy for assignments.

Only purely functional languages shall be called functional. Would you call Java a functional language because they added Stream API and lambdas? Would you call C a functional language because it has pointers to functions?

My school teaches Racket first, then moves on to Java.

Shit, you are ignorant!

JavaScript is basically Scheme + Prototypes.

Do us all a favour and XOR yourself.

>why are you using standard nomenclature when I don't want you to
>only call things what I want you to call them
Wow, no wonder most of academic are lefists: linguistic deconstructionalism is deep within you!

>JavaScript is basically Scheme
Haha! No. It is basically Self. Comparing JS to Scheme shows your ignorance, not mine.
Comparing anything without TCO to Scheme is ridiculous.

But JavaScript has TCO, user. You should stop posting, you just keep embarrassing yourself.

I'm not the user you're arguing with, and I do agree that JS is functional, however...
>But JavaScript has TCO, user.
Depends greatly on environment. To the best of my knowledge you have to use strict AND pass various flags to node to enable it.

>But JavaScript has TCO,
Orly? Show me where it is defined in standard.
Or maybe V8 provides TCO? Let's test it... Hmm, nope, no TCO.

The only time I used functional languages in college was in my courses on compilers.

For that job at least, functional languages work really well.

A compiler is literally just a complicated function. binary = f(source). Interactive software doesn't fit the functional paradigm so easily.

It's part of the ES6 standard, but no engine has it implemented yet.

This. Once you have to develop eventful stateful applications, which covers most production code, purely functional languages are a terrible idea. Anything that can not be simplified to a stateless in -> out procedure should not be written in one.

Same goes for PLs with mandatory OOP. The only good languages are largely multiparadigm.

A METHOD IS A FUNCTION YOU TURD.

Oh, right, current standard contains "14.6 Tail Position Calls". Okay, modern ES has TCO, but it's too late to call JS a "Scheme with prototypes".

I'm not the retard doing that. JS is a rushed baby of Self, C and Sun's cock.

But you need education to see that, my friend. So why bother when real world has no use for it.

Stay ignorant, plebs.

Haskell is literally only used in university

Because immutability makes multi-threading trivial.

And useless.

What's more retarded: calling JavaSript "Scheme with prototypes" or calling JavaScript "not a functional language"?

>only purely functional languages shall be called functional
>only purely object-oriented languages shall be called object-oriented
>only purely event-driven languages shall be called event-driven
Uh... that's not how the world works, kid.

To postulate a state-less model of computation on top of a machinery whose most eminent characteristic is state, seems to be an odd idea, to say the least. The gap between model and machinery is wide, and therefore costly to bridge. No hardware support feature can wash this fact aside: It remains a bad idea for practice. This has in due time also been recognized by the protagonists of functional languages. They have introduced state (and variables) in various tricky ways. The purely functional character has thereby been compromised and sacrificed. The old terminology has become deceiving.

>Only purely functional languages shall be called functional.

Then Lisp isn't even functional.

If you support higher-ordered functions, anonymous functions, and generally utilize immutable data structures, you're a functional lang to me.

Check out react. It can be used to build functional, stateful, and interactive applications on the web.

>tattoo
D R O P P E D

>To postulate a state-less model of computation
Where is this state-less meme coming from? Functional languages __have__ state -- they do not have mutable state.

Where is this immutable meme coming from?

(defvar a '(1 2 3))
(defvar b (cons 0 a))

(eq a b) ; false -- b and a are different structure objects

(equal a '(1 2 3)) ; true -- a is the same structure as it was before
(equal b '(0 1 2 3)) ; true -- b is 0 cons'd with a


That is immutability. Generally, in Lisp, if you are writing something like:
(defvar a '(1 2 3))
(setf (car a) 0)

that is considered poor form (although possible.) So while Common Lisp does not explicitly forbid mutable state, its usage is reserved for performance critical regions.

Languages like Clojure [1] and Haskell exclusively offer persistent data structures.

[1] You can call impure Java code

Also, going to add this:

(defvar dog "dog")
(defvar cat "cat")
(defvar turtle "turtle")

(defvar a (list dog cat))
(setq b (cons turtle a))

(eq (cdr b) a) ; true - these are the __same__ objects in memory! No wasteful copy.


Writing Lisp using persistent data structures is usually more efficient, aside from the edge case where you are frequently appending to a List. Even Clojure recognizes the advantages of local mutability -- you can declare a local transient variable and mutate it. On the rationale for the introduction of transients, Hickey asks us to consider: If a pure function mutates some local state, is it still pure? Use of transients are isolated to a single thread, and are therefore safe. This can be a great optimization trick.

Persistent data structures by default have tons of advantages. I no longer need to worry about how different interacting systems modify shared data structures; I am guaranteed that my system will function as intended. Sure, you won't write a kernel with it, but most applications aren't a kernel.

Purely functional algorithms are also very exciting. If you're interested in the subject, I strongly recommend the book "Purely Functional Data Structures." Particularly the implementation of red-black trees. When you are not mutating state, you are left with only the essential ideas of an algorithm.

This doesn't mean you don't ever need an unsafe language. Sometimes you do because of performance. But premature optimization is the root of all evil, only if you can't meet performance criteria in a safe language should you drop into a dirty language for that component.

Holy shit, functional programming an actual fucking sect!

Why are they so brainwashed that they literally refer to the languages that don't follow their creed as "impure", "unsafe", "dirty"?

Religion fucks your brain up, fâm.

Because they are those things. By default, algorithms in imperative languages cannot be safely threaded.

The fancy term for data structures that are not-persistent are 'ephemeral data structures', if that sounds less religious to you.

>algorithms in imperative languages cannot be safely threaded

>What are locks?
>What are semaphores?
>What are mutexes?
>What are critical sections?

>leaving out the prefix 'by default'
You would have to modify the existing code to acquire locks, etc. By default, this is then unsafe.

Also, there's a lot of literature out there that suggests that STM is more efficient than lock-based concurrency. For STM to work, you need persistent data structures, although some people have added STM layers for C(++). But if you're writing C and C++ that way, it's no longer idiomatic and most standard library features will no longer work. You'd basically be writing in a functional style in those languages.

delivery.acm.org/10.1145/1190000/1189288/p24-adl-tabatabai.pdf?ip=140.103.52.162&id=1189288&acc=OPEN&key=1D8E1CA5B8D7D8DD.C7439B0D3DAFB569.4D4702B0C3E38B35.6D218144511F3437&CFID=858340262&CFTOKEN=72018567&__acm__=1477673999_a3a2bf37c0a8c45e6570badd66b4eaa6

That does fair justice on the subject on the problems with locks.

Academia has little to no connection with the real world.

>taking hardware and operating systems class
>all we do is program in java through console
FUCK THIS CLASS

>took operating systems class
>solved bounded-buffer problem in C++
>wrote keyboard driver in C
Feels Goodman.

I understand doing some programing. But fucking hell Java?
And we don't even talk about actual fucking hardware.
I WANT TO LEARN ABOUT HARDWARE THATS THE NAME OF THE FUCKING CLASS

WPI?

Attractive Punjabi girls thread?

Get fucked, pajeet

Here you go my friend

It's used in business, but mostly to write parsers and compilers for other custom languages. There are a few databases and things at Facebook (they use every language that isn't nailed down) and a bunch of top secret finance tools at HFT shops and things like that.