4 ms·
FP is not new. OO is not new. They are tools in the toolkit. Take an object with a bunch of instance methods. They are all equivalent to functions with a hidden
by erpellan 8y ago
FP is not new. OO is not new. They are tools in the toolkit. Take an object with a bunch of instance methods. They are all equivalent to functions with a hidden first parameter. If you make 'this' explicit you've got pure functions. It's not magic.
Intellij even has an automated refactoring for it in kotlin. You can take a function and convert it to an extension method and back again:
fun String.foo(a: Int)
vs
fun foo(self: String, a: Int)
The real fun of FP is building simple functions that operate on a single value and then stringing them together, generalising to lists of values, filtering etc.
MapReduce is functional programming. At epic scale. It's name is literally a portmanteau of two of the most fundamental higher order functions.
FP rocks.
- dragonwriter 8y ago> Take an object with a bunch of instance methods. They are all equivalent to functions with a hidden first parameter. If you make 'this' explicit you've got pure functions. Well, you’ve got normal imperative procedures that maybe return a value. Pure functions mean something else.
- tabtab 8y agoThe domain and use-case is not clear to me here. I want to know what real-world task is to be performed, not how to convert one language to another language.