4 ms·
Functional programming boils down to 2 important ideas. 1) Referential Transparency - Basically, you can take an expression in your program, and replace it
by weatherlight 4y ago
Functional programming boils down to 2 important ideas.
1) Referential Transparency - Basically, you can take an expression in your program, and replace it with the result of that expression. and your program will run
the same, every time.
2) Immutability - the idea that data cannot be deleted or changed.
Having a language/runtime that truly embodies these two principles completely eliminates entire classes of problems in regards to parallelism and concurrency.
Some languages and their implementations are very ergonomic to programming in a FP style, some are not. ( Im looking at every imperative lang that has lambda semantics and now says they are FP. )
I think people get hemmed up talking about what FP is. There's nothing in there, though about Category Theory, Algebraic Data Types, Static or Dynamic Typing Disciplines, etc.
- sa46 4y ago> I think people get hemmed up talking about what FP is You've defined purely functional programming, which seems to be the increasingly common meaning of FP. The original definitions only explicitly refer to constructing programs by combining functions: A History of Lisp http://jmc.stanford.edu/articles/lisp/lisp.pdf http://jmc.stanford.edu/articles/lisp/lisp.pdf > LISP is characterized by [...] composition of functions as a tool for forming more complex functions. Can programming be liberated from the von Neumann style? https://dl.acm.org/doi/pdf/10.1145/359576.359579 https://dl.acm.org/doi/pdf/10.1145/359576.359579 > informal description of a class of simple applicative programming systems called functional programming (FP) systems, in which "programs" are simply functions without variables. However, Backus defines his functional programming system mathematically, which could reasonably be construed as referentially transparent.
- weatherlight 4y agohttps://www.cs.cmu.edu/~crary/819-f09/Landin66.pdf https://www.cs.cmu.edu/~crary/819-f09/Landin66.pdf First mention of "Functional Programming" is in the paper, "The next 700 Languages" from July 1965. It's heavily implied that FP is programming with things that resemble mathematical objects and have the above properties, not merely just programming with "functions" so to speak. https://youtu.be/1_Eg8KYq2iQ?t=1230 https://youtu.be/1_Eg8KYq2iQ?t=1230 <- Great talk on what FP programming style is.