Let's say I have the following function (in JavaScript, for sake of example):

function foo() {
  var bar = function () {return 'lol';}
  return bar;

This function returns other functions. I had the misconception that this was called a generator, but on reading around, that's something different entirely. Googling this question didn't give me anything useful.

So, what do I call a function that creates functions?

  • 7
    "Higher order function" – Fabio Sep 10 '18 at 3:54
  • 1
    A higher order function is a function that takes a function as an argument, or returns a function – Fabio Sep 10 '18 at 3:55
  • 1
    I call them funky funcs. – RibaldEddie Sep 10 '18 at 6:41
  • I think Fabio is right, but he forgot to add the Wikipedia link where he cited from. – Doc Brown Sep 10 '18 at 6:45
  • 1
    I think RibaldEddie is probably right, but the more common term is "Higher order function", as Fabio stated. – neilsimp1 Sep 10 '18 at 12:15

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.