All Questions
5 questions
10
votes
5
answers
8k
views
How to name a function that returns a function?
Let's say, for example, that I have a function makeFoo that makes another function foo:
function makeFoo(string) {
return () => string
}
const foo = makeFoo('bar');
I know that makeFoo is a ...
4
votes
1
answer
1k
views
How to move from OOP object composition to FP function composition in C#
I have been working for a few weeks on a new web project and I am realizing that all I am doing is basically calculations and transformations on data, and that most of my classes do not contain any ...
2
votes
1
answer
877
views
Why use tuples as function parameters in languages that support currying?
In languages that support currying, I can't think of many cases where using a tuple as function input parameters would be better than breaking the tuple apart into multiple parameters, which then ...
20
votes
1
answer
14k
views
Passing a Scala function to a Java 8 method
The following Scala code works and can be passed to a Java method expecting a function. Is there a cleaner way to do this? Here's my first pass:
val plusOne = new java.util.function.Function[Int,...
6
votes
3
answers
1k
views
Functional Methods on Collections
I'm learning Scala and am a little bewildered by all the methods (higher-order functions) available on the collections. Which ones produce more results than the original collection, which ones ...