Difference between high-order and first-class functions

11

Functional language, what is the difference between high-order functions and first-class functions in> first-class functins )?

In JavaScript, what would be the difference between these two types of functions?

    
asked by anonymous 02.04.2014 / 14:51

1 answer

14

A language has first-class functions , when functions can be treated as values that can be passed, manipulated, returned ... ie it is possible to operate functions. This concept is an attribute of language, or she has or does not have it.

High order function is a function that receives or returns a function. Only a high-order function can be defined if the language has first-class functions , since functions are "passable" . This concept is an attribute of the function, or it is or is not.

EDIT

Languages that do not have first class functions, such as C, still allow you to create high order functions using function pointers.

Javascript is a language that has first-class functions, that is, it is possible to pass, return and operate functions.

Reference:

02.04.2014 / 17:03