Higher-order functions are functions which either take functions as arguments or return them as output (or both). They are a cornerstone of functional programming.
1
vote
3answers
83 views
Using higher order functions to apply m out of M filter's and then transform data of size n?
Total no: of filters possible is M . User can select m filters where m <= M . A typical example is files from a folder , he could say modified between so and so date , start with so and so and so ...
0
votes
2answers
143 views
higher order functions equivalent construct in TIOBE top 10 languages [closed]
I'm trying to find a language construct equivalent to higher order functions in the top 10 languages from TIOBE index.
Here are my results so far:
C - function pointers
Java - anonymous methods, ...
0
votes
0answers
64 views
Why use subtyped functions?
Say you have arguments A1 >: A2 (contra-variant), and return types B1 <: B2 (covariant).
The corresponding functions are such that:
A1 => B1 <: A2 => B2
Sometimes, this makes sense to me - ...
2
votes
1answer
105 views
How to simplify unit testing with higher order functions?
this is not a question on how to write unit tests
this is not a question on what to test
this is a question on reducing the typing needed overall for a personal testing framework
I know you can ...
8
votes
1answer
549 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 ...
8
votes
4answers
1k views
What's special about currying or partial application?
I've been reading articles on Functional programming everyday and been trying to apply some practices as much as possible. But I don't understand what is unique in currying or partial application.
...
2
votes
3answers
304 views
Naming convention for higher order functions?
Is there a naming convention for higher order functions? That is, functions which return other functions.
An example in Javascript:
function onlyDivisibleBy(div) { // <-- higher order function
...
2
votes
1answer
142 views
Non-trivial functions that operate on any monad [closed]
I'm looking for examples of interesting methods that take an arbitrary monad and do something useful with it.
Monads are extremely general, so methods that operate on monads are widely applicable. On ...
7
votes
1answer
447 views
Origin of common list-processing function names
Some higher-order functions for operating on lists or arrays have been repeatedly adopted or reinvented. The functions map, fold[l|r], and filter are found together in several programming ...
7
votes
2answers
293 views
Who first coined the term Higher Order Function and/or First Class Citizen?
I've come to understand that long before Haskell, O'Caml or LISP, higher order functions were an academic research subject and in mathematics, Schönfinkel (in 1967) and Haskell Curry (in 1968) already ...
4
votes
2answers
264 views
Determinism of functions using PRNG in Clojure and functional languages
I'm a bit surprised by a sentence found in the book "Clojure Programming" (1st [and only as I write this!?] edition), page 78:
It should be obvious that it's impossible to deterministically test a
...
6
votes
3answers
542 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 ...