What is this functional “pattern” called?

2019-04-08 09:25发布

I was fooling around with some functional programming when I came across the need for this function, however I don't know what this sort of thing is called in standard nomenclature. Anyone recognizes it?

function WhatAmIDoing(args...)
   return function()
       return args
   end
end

Edit: generalized the function, it takes a variable amount of arguments ( or perhaps an implicit list) and returns a function that when invoked returns all the args, something like a curry or pickle, but it doesn't seem to be either.

7条回答
地球回转人心会变
2楼-- · 2019-04-08 09:58

In functional programming a function that takes another function as an argument or returns another function is called a higher-order function.

查看更多
登录 后发表回答