Talk:Higher-order function

message: Functions that are not higher-functions are (I believe) first-order functions. It would be nice if someone could find a citation of this (I couldn't) any integrate it into the article. Oligomous (talk) 22:24, 27 December 2009 (UTC)
replies: text: Would be nice if this definition were expanded. I landed on this page looking for information on first-order functions (Map Reduce), but saying that they are those which are not higher-functions isn't particularly descriptive without the set of possibilites being known or stated. If higher-functions take a function as parameter and return a function, then "everything else" are those functions that don't take functions as parameters and don't return a function; that can range from taking no parameters to taking any parameters which are not functions, and the same for the return type. I'm none the wiser.  — Preceding unsigned comment added by 130.149.246.89 (talk) 10:37, 14 July 2016 (UTC)
thread_title:  First-order function 

message: http://en.wikipedia.org/wiki/Talk:Fold_%28higher-order_function%29#other_high-order_functions_.3F —The preceding unsigned comment was added by 212.176.32.19 (talk) 09:20, 15 May 2007 (UTC)
thread_title:  other high-order functions ? 

message: The article reiterates the common confusion that a function which returns a function is higher order. According to this (+) : Int -> (Int -> Int) is higher order?  The type is isomorphic to Int x Int -> Int which is not higher order. Moreover the standard definition of order of a function is maximum of order of domain+1 and order of codomain. According to this the type of (+) is first order as one would expect and not higher order.
--Thorsten (talk) 12:54, 2 March 2010 (UTC)
replies: text: are they really isomorphic? Int -> (Int -> Int) demands its arguments one at a time; (Int,Int) -> Int demands both its arguments at the same time, it seems. Note the forbidden t-word. I guess notions of functions and notions of computations get conflated here ... and BTW or course (+) is higher-order in e.g. Haskell, where it has the first type. Its domain is numbers, codomain - incrementing functions. Currying (i.e. partial specification) in such languages is just partial application.  WillNess (talk) 09:58, 1 July 2011 (UTC)
thread_title:  Curried functions higher order 

message: The main point about higher order functions is that they return a function.
It does not matter if it is curried or uncurried.
A function just accepting one or more functions is not high order.
Passing pointers to functions is more or less similar to pass any id to select a function.
see for example this pseudo-code:
 pseudo_high_order_funs(f,args)
 case f of:
  1:return f1(args);
  2:return f2(args);
  3:return f3(args);
 esac
 map_array(pass_by_val: array,pass_by_val: 1, pass_by_ref: out_array)
   for i:=1 to lenght(array)
     out_array[i]:=pseudo_high_order_funs(1,array[1]);
   next i;
 end;
Languages implemented as interpreters of text code can simulate high order functions.
The trick is to write a function on a file at execution time, then call it.
because it is interpreted from text code, it works.
I saw this trick in an old hp basic manual. about 1976.
In principle, this trick may be implemented in compiled languages, by writing the source code, compiling it at run time, then dynamic linking it.
I never did this trick, but this should work.
If anyone of you are skilled enough to write some examples in this sense in some unix (linux) and windows (I am some outdated in this issues), those tricks may be included in the article.  —Preceding unsigned comment added by 189.217.253.136 (talk) 05:51, 11 March 2011 (UTC)
thread_title:  Higher order functions must return a function 

message: Does the adjective "Higher Order" only apply to typed functions?  or does it equally apply to untyped functions? does Barendregt have anything to say on this?
In the untyped lambda calculus there are no types.  There are functions (lambda abstractions) but they are not typed.  The syntax permits any expression to be applied to any other expression, and if the expression on the left (being applied) is a lambda abstraction then it will match the left hand side of the beta reduction rule, thereby triggering a beta reduction.  The type of the argument is never checked because there is no type system.  Similarly the type of the result is never checked because there is no type system.  It therefore may appear strange to read that "in the untyped lambda calculus all functions are Higher Order".  In the untyped lambda calculus (without constants) a lambda abstraction can be thought of as an untyped function of one argument, and such a function both takes and returns either a variable name or a function or the result of applying a function to an argument.  In essence, when variable names are replaced by their bound values, and when applications are replaced by their results, everything is represented as a function (a lambda abstraction) and therefore in this sense every function takes a function as an argument and returns a function as its result.  — Preceding unsigned comment added by 10-clarity-01 (talk • contribs) 20:22, 25 July 2016 (UTC)
thread_title:  Untyped lambda calculus and higher order functions 

message: Example sections seems to be all wrong. Might need review from someone who really knows FP.  — Preceding unsigned comment added by 117.207.1.89 (talk) 10:35, 1 June 2012 (UTC)
replies: text: I have to agree.  I'm looking at the definition of, 'takes a function and returns a function', and the examples don't do that (at least the ones I looked at).  They take a function as parameter, but then return a value after applying the parameterized function a couple of times.  This contradicts the definition.  On my understanding the examples are wrong and the definition correct.  If these examples are valid then the definition provided is lacking. 76.103.48.252 (talk) 15:22, 8 September 2015 (UTC)
replies: text:  I removed some of the "wrong" examples. There is little need to give examples in so many languages in any case. —Ruud 19:44, 8 September 2015 (UTC)
thread_title:  Example sections seems to be all wrong. Might need review from someone who really knows FP 

message: The first of the external links (Higher-order functions and variational calculus) is no longer valid. Maybe someone can replace it with another equivalent source?  — Preceding unsigned comment added by 77.21.86.100 (talk) 11:13, 6 October 2013 (UTC)
thread_title:  Link Broken 

message: Despite the warning that the Examples section is not intended to compare and contrast languages, there are three examples that are equivalents.  Perhaps either the warning could be removed or the two superfluous examples.  Alternately, they could reasonably be converted to examples of other higher-order functions.
24.102.110.195 (talk) 00:59, 26 March 2014 (UTC)
thread_title:  Language comparison?? 

message: On Wikipedia, the Functor article refers to a concept in category theory, but the higher-order function article also mentions "functor" as a synonym for "higher-order function". Are these concepts really the same? Jarble (talk) 17:56, 10 November 2014 (UTC)
replies: text: In general no, because the word functor is used in different ways in different fields. See Functor (disambiguation). Some of those uses have little to do with higher order functions. Even in the computer science context, this isn't true. In Haskell, for instance, a Functor is a typeclass, whereas a higher order function is simply a function that consumes or produces functions. --Mark viking (talk) 21:42, 10 November 2014 (UTC)
thread_title:  Is "higher-order function" synonymous with "functor"? 

message: The haskel example does not implement the same functionality as the other code examples. F(7) = 1 vs f(7) = 13.
91.158.251.58 (talk) 01:59, 26 September 2016 (UTC)
thread_title:  Haskel example 

message: Perl clearly supports (and has always supported) Higher Order Functions and Currying. Mark Jason Dominus demonstrated this and more about Perl in the Book "HIGHER-ORDER PERL, Transforming Programs with Programs" published in 2005 ISBN: 1-55860-701-3  — Preceding unsigned comment added by Aimass (talk • contribs) 20:04, 4 May 2020 (UTC)
thread_title:  Was Perl intentionally left out for some reason? 

message: From the lead:
"Higher-order functions should not be confused with other uses of the word "functor" throughout mathematics, see Functor (disambiguation)."
This sentence seems to refer back to some previous mention of the word 'functor', but there is no such mention. So this sentence makes no sense.
However, the sentence does follow a mention of the word 'functional', which, like functor, has multiple meanings. So perhaps the intent here was to disambiguate the subject of the current article from other meaning of 'functional'? Gwideman (talk) 10:00, 27 February 2021 (UTC)
thread_title:  Non-sequitur regarding "functor"