Live data from Hacker News

Functional Programming at Facebook

scs.stanford.edu

31–40 of 102 posts

Re: Functional Programming at Facebook

#31

Earlier quoted context omitted.

> Because there's functional as in only using pure functions (Haskell, ocaml) This is not true. Having written a good amount of OCaml I would argue that programming with side-effects in OCaml is extremely approachable - almost as much as Clojure. There are mutable data structures in the stdlib (Array, Hashtbl) and IO etc. is straightforward. Like Clojure, there exists a ref type which can be easily mutated. It's one…

I'd distinguish between (at least) three degrees of “purity”: (0) Absolutely anything goes. Examples: Racket (in the REPL), Lisp, Clojure, Scala, Erlang, etc. (1) Values are immutable, but any computation might have any effect. Examples: Standard ML, OCaml (mostly), Racket (mostly). (2) Values are immutable, and computations are type-annotated with their possible effects. Examples: Haskell, Idris, Ur/Web.

Pretty strange that you put Clojure in the "anything goes" category when it has been the clear leader when it comes to immutability. Lots of those languages you put in the other categories don't even have persistent data structures in their standard library.

Re: Functional Programming at Facebook

#32
post #14

Earlier quoted context omitted.

Although this reason sounds plausible, it is quite surprising since one of the first functional languages - Lisp was dynamically typed.

Lisp isn't a functional language.

That's a very HN comment. Completely wrong but delivered with strong convictions.

Lisp doesn't actually exist. Lisp is just axioms. You run an implementation of Lisp allowing various operations. Some flavors actually have (practically) zero mutability. You just create functions and cons cells and the rest of the world gets built on top of those.

But, pure functional systems are useless (to be purely functional would mean you can't even do I/O... your program would just heat up the computer, which, in a way, is its own form of output, so you can't ever be fully functional).

Every functional language gets non-functional at some point for data processing, bootstrapping, loading/saving programs, and the best functional languages even have optional mutability constructs for performance (see: !). You can't create the most performant data structures possible if all your operations require path copying, but mutability should be reserved for internal high performance library creation and avoided in business logic/application level code to make systems easier to reason about.

Re: Functional Programming at Facebook

#33
post #31

Earlier quoted context omitted.

I'd distinguish between (at least) three degrees of “purity”: (0) Absolutely anything goes. Examples: Racket (in the REPL), Lisp, Clojure, Scala, Erlang, etc. (1) Values are immutable, but any computation might have any effect. Examples: Standard ML, OCaml (mostly), Racket (mostly). (2) Values are immutable, and computations are type-annotated with their possible effects. Examples: Haskell, Idris, Ur/Web.

Pretty strange that you put Clojure in the "anything goes" category when it has been the clear leader when it comes to immutability. Lots of those languages you put in the other categories don't even have persistent data structures in their standard library.

Here is why: http://pastebin.com/t3Q3CW4j

This is particularly infuriating because the proper way to handle bound variables is already known: https://en.wikipedia.org/wiki/De_Bruijn_index .

Re: Functional Programming at Facebook

#34
post #13

> Even though it is probably the most practically used functional language. Scala have 30th place on Tiobe index, while Erlang have 42th: http://www.tiobe.com/index.php/tiobe_index .

Yes, but it is #14 Redmonk's rankings:

https://redmonk.com/sogrady/2015/07/01/language-rankings-6-1...

Re: Functional Programming at Facebook

#35
post #2

Well also WhatsApp handling 1B+ users with Erlang, and with (what used to be?) only a handful of engineers. But somehow the Haskell, OCaml and Scala users never want to include Erlang when talking about "functional". Even though it is probably the most practically used functional language.

> Even though it is probably the most practically used functional language. Would love to get some evidence to back up Erlang being the most practically used functionally used language, because for all I know, it's hardly used at all these days.

"practical" as in: the programing model fits the problem domain model of modern systems.

But, "practical" doesn't show up on everybody's radar much these days with so much effort focused around fads-of-the-half-decade.

Erlang is made by professionals with decades of experience who grow the system towards being the most stable, scalable, safe, and as understandable as possible. People use Erlang, solve problems, stay quiet, then make money using it.

On the other hand, the thought leader these days seems to be Go (even though it's made by out of touch weirdos (review: http://www.evanmiller.org/four-days-of-go.html)) and has a creepy cult/fanatical following more suited to tribal sportsball teams than what we would expect from professional technical work needing to be stable over the long term.

Re: Functional Programming at Facebook

#36
post #28

Earlier quoted context omitted.

Although this reason sounds plausible, it is quite surprising since one of the first functional languages - Lisp was dynamically typed.

Just to double down on the points of some other commenters here: "Functional" is a pretty difficult word to pin down these days. That said, there seems to be a clear camp in what might be better called "denotational" programming which centers around the ML-alike languages, the dependently typed languages, and Scala. Lisp is not much at all like these languages. Nor is Erlang, though it is vastly closer.

I wouldn't call Scala a “functional” language. It's an object-oriented language that happens to be able to encode many Haskell idioms, with varying degrees of awkwardness. But you can write Java in Scala too, and, in the eyes of some, the result will even be more natural.

Out of curiosity: Would you consider Prolog a language in which you can do “denotational” programming?

Re: Functional Programming at Facebook

#37
post #32
post #14

Earlier quoted context omitted.

Lisp isn't a functional language.

That's a very HN comment. Completely wrong but delivered with strong convictions. Lisp doesn't actually exist. Lisp is just axioms. You run an implementation of Lisp allowing various operations. Some flavors actually have (practically) zero mutability. You just create functions and cons cells and the rest of the world gets built on top of those. But, pure functional systems are useless (to be purely functional would…

> Lisp is just axioms.

Do you even know what an axiom is? (In mathematical logic, of course.)

Re: Functional Programming at Facebook

#38
post #14

Earlier quoted context omitted.

Lisp isn't a functional language.

You're both right and wrong, it's just that "functional" has a lot of different definitions and nobody can agree on which one is correct. As a result, "functional" has become pretty much meaningless when describing a programming language.

Functional programming has always been the name of a programming paradigm that treats computation as the evaluation of mathematical functions.

Re: Functional Programming at Facebook

#39
post #8

Earlier quoted context omitted.

Because there's functional as in only using pure functions (Haskell, ocaml) and functional as in access to higher order functions (JavaScript, erlang, clojure)

i thought ocaml ain't pure like that?

There are a couple of monadic IO systems for Ocaml - Lwt and Async which are pretty commonly used - and enable writing code using typed mutation/side effects.

Re: Functional Programming at Facebook

#40
post #32

Earlier quoted context omitted.

That's a very HN comment. Completely wrong but delivered with strong convictions. Lisp doesn't actually exist. Lisp is just axioms. You run an implementation of Lisp allowing various operations. Some flavors actually have (practically) zero mutability. You just create functions and cons cells and the rest of the world gets built on top of those. But, pure functional systems are useless (to be purely functional would…

> Lisp is just axioms. Do you even know what an axiom is? (In mathematical logic, of course.)

Do you even lift bro?
Post reply on HN