Anonymous function

{{short description|Function definition that is not bound to an identifier}}

In computer programming, an anonymous function (function literal, expression or block) is a function definition that is not bound to an identifier. Anonymous functions are often arguments being passed to higher-order functions or used for constructing the result of a higher-order function that needs to return a function.{{cite web |title=Higher order functions |url=http://learnyouahaskell.com/higher-order-functions |access-date=3 December 2014 |website= |publisher=learnyouahaskell.com |language=en-US}}

If the function is only used once, or a limited number of times, an anonymous function may be syntactically lighter than using a named function. Anonymous functions are ubiquitous in functional programming languages and other languages with first-class functions, where they fulfil the same role for the function type as literals do for other data types.

Anonymous functions originate in the work of Alonzo Church in his invention of the lambda calculus, in which all functions are anonymous, in 1936, before electronic computers.{{citation|title=Models of Computation: An Introduction to Computability Theory|series=Undergraduate Topics in Computer Science|first=Maribel|last=Fernandez|publisher=Springer Science & Business Media|year=2009|isbn=9781848824348|page=33|url=https://books.google.com/books?id=FPFsnzzebhQC&pg=PA33|quote=The Lambda calculus ... was introduced by Alonzo Church in the 1930s as a precise notation for a theory of anonymous functions}} In several programming languages, anonymous functions are introduced using the keyword lambda, and anonymous functions are often referred to as lambdas or lambda abstractions. Anonymous functions have been a feature of programming languages since Lisp in 1958, and a growing number of modern programming languages support anonymous functions.

{{toclimit|3}}

Names

The names "lambda abstraction", "lambda function", and "lambda expression" refer to the notation of function abstraction in lambda calculus, where the usual function {{math|1={{itco|f}}(x) = M}} would be written {{math|1=(λx.{{itco|M}})}}, and where {{mvar|M}} is an expression that uses {{mvar|x}}. Compare to the Python syntax of lambda x: M.

The name "arrow function" refers to the mathematical "maps to" symbol, {{math|xM}}. Compare to the JavaScript syntax of x => M.{{cite web |title=Arrow function expressions - JavaScript |url=https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions |access-date=August 21, 2019 |website=MDN |language=en-US}}

Uses

{{Unreferenced Section|date=February 2018}}

Anonymous functions can be used for containing functionality that need not be named and possibly for short-term use. Some notable examples include closures and currying.

The use of anonymous functions is a matter of style. Using them is never the only way to solve a problem; each anonymous function could instead be defined as a named function and called by name. Anonymous functions often provide a briefer notation than defining named functions. In languages that do not permit the definition of named functions in local scopes, anonymous functions may provide encapsulation via localized scope, however the code in the body of such anonymous function may not be re-usable, or amenable to separate testing. Short/simple anonymous functions used in expressions may be easier to read and understand than separately defined named functions, though without a descriptive name they may be more difficult to understand.

In some programming languages, anonymous functions are commonly implemented for very specific purposes such as binding events to callbacks or instantiating the function for particular values, which may be more efficient in a Dynamic programming language, more readable, and less error-prone than calling a named function.

The following examples are written in Python 3.

= Sorting =

When attempting to sort in a non-standard way, it may be easier to contain the sorting logic as an anonymous function instead of creating a named function.

Most languages provide a generic sort function that implements a sort algorithm that will sort arbitrary objects.

This function usually accepts an arbitrary function that determines how to compare whether two elements are equal or if one is greater or less than the other.

Consider this Python code sorting a list of strings by length of the string:

>>> a = ['house', 'car', 'bike']

>>> a.sort(key=lambda x: len(x))

>>> a

['car', 'bike', 'house']

The anonymous function in this example is the lambda expression:

lambda x: len(x)

The anonymous function accepts one argument, x, and returns the length of its argument, which is then used by the sort() method as the criteria for sorting.

Basic syntax of a lambda function in Python is

lambda arg1, arg2, arg3, ...:

The expression returned by the lambda function can be assigned to a variable and used in the code at multiple places.

>>> add = lambda a: a + a

>>> add(20)

40

Another example would be sorting items in a list by the name of their class (in Python, everything has a class):

>>> a = [10, 'number', 11.2]

>>> a.sort(key=lambda x: x.__class__.__name__)

>>> a

[11.2, 10, 'number']

Note that 11.2 has class name "float", 10 has class name "int", and 'number' has class name "str". The sorted order is "float", "int", then "str".

=Closures=

{{Main|Closure (computer programming)}}

Closures are functions evaluated in an environment containing bound variables. The following example binds the variable "threshold" in an anonymous function that compares the input to the threshold.

def comp(threshold):

return lambda x: x < threshold

This can be used as a sort of generator of comparison functions:

>>> func_a = comp(10)

>>> func_b = comp(20)

>>> print(func_a(5), func_a(8), func_a(13), func_a(21))

True True False False

>>> print(func_b(5), func_b(8), func_b(13), func_b(21))

True True True False

It would be impractical to create a function for every possible comparison function and may be too inconvenient to keep the threshold around for further use. Regardless of the reason why a closure is used, the anonymous function is the entity that contains the functionality that does the comparing.

=Currying=

{{Main|currying}}

Currying is the process of changing a function so that rather than taking multiple inputs, it takes a single input and returns a function which accepts the second input, and so forth. In this example, a function that performs division by any integer is transformed into one that performs division by a set integer.

>>> def divide(x, y):

... return x / y

>>> def divisor(d):

... return lambda x: divide(x, d)

>>> half = divisor(2)

>>> third = divisor(3)

>>> print(half(32), third(32))

16.0 10.666666666666666

>>> print(half(40), third(40))

20.0 13.333333333333334

While the use of anonymous functions is perhaps not common with currying, it still can be used. In the above example, the function divisor generates functions with a specified divisor. The functions half and third curry the divide function with a fixed divisor.

The divisor function also forms a closure by binding the variable d.

=Higher-order functions=

A higher-order function is a function that takes a function as an argument or returns one as a result. This is commonly used to customize the behavior of a generically defined function, often a looping construct or recursion scheme. Anonymous functions are a convenient way to specify such function arguments. The following examples are in Python 3.

==Map==

{{Main|Map (higher-order function)}}

The map function performs a function call on each element of a list. The following example squares every element in an array with an anonymous function.

>>> a = [1, 2, 3, 4, 5, 6]

>>> list(map(lambda x: x * x, a))

[1, 4, 9, 16, 25, 36]

The anonymous function accepts an argument and multiplies it by itself (squares it). The above form is discouraged by the creators of the language, who maintain that the form presented below has the same meaning and is more aligned with the philosophy of the language:

>>> a = [1, 2, 3, 4, 5, 6]

>>> [x * x for x in a]

[1, 4, 9, 16, 25, 36]

==Filter==

{{Main|Filter (higher-order function)}}

The filter function returns all elements from a list that evaluate True when passed to a certain function.

>>> a = [1, 2, 3, 4, 5, 6]

>>> list(filter(lambda x: x % 2 == 0, a))

[2, 4, 6]

The anonymous function checks if the argument passed to it is even. The same as with map, the form below is considered more appropriate:

>>> a = [1, 2, 3, 4, 5, 6]

>>> [x for x in a if x % 2 == 0]

[2, 4, 6]

==Fold==

{{Main|Fold (higher-order function)}}

A fold function runs over all elements in a structure (for lists usually left-to-right, a "left fold", called reduce in Python), accumulating a value as it goes. This can be used to combine all elements of a structure into one value, for example:

>>> from functools import reduce

>>> a = [1, 2, 3, 4, 5]

>>> reduce(lambda x, y: x * y, a)

120

This performs

:

\left(

\left(

\left(

1 \times 2

\right)

\times 3

\right)

\times 4

\right)

\times 5

= 120.

The anonymous function here is the multiplication of the two arguments.

The result of a fold need not be one value. Instead, both map and filter can be created using fold. In map, the value that is accumulated is a new list, containing the results of applying a function to each element of the original list. In filter, the value that is accumulated is a new list containing only those elements that match the given condition.

List of languages

The following is a list of programming languages that support unnamed anonymous functions fully, or partly as some variant, or not at all.

This table shows some general trends. First, the languages that do not support anonymous functions (C, Pascal, Object Pascal) are all statically typed languages. However, statically typed languages can support anonymous functions. For example, the ML languages are statically typed and fundamentally include anonymous functions, and Delphi, a dialect of Object Pascal, has been extended to support anonymous functions, as has C++ (by the C++11 standard). Second, the languages that treat functions as first-class functions (Dylan, Haskell, JavaScript, Lisp, ML, Perl, Python, Ruby, Scheme) generally have anonymous function support so that functions can be defined and passed around as easily as other data types.

{{Expand list|date=August 2008}}

{{sticky header}}

class="sortable wikitable sticky-header" style="text-align: left; font-size: 0.92em;"

|+ List of languages

LanguageSupportNotes
ActionScript

| {{yes|{{Y}}}}

|

Ada

| {{partial|{{Y}}}}

| Expression functions are a part of Ada2012, access-to-subprogram{{Cite web |title=Access Types |url=https://www.adaic.org/resources/add_content/standards/05rm/html/RM-3-10.html#S0082 |access-date=2024-06-27 |website=www.adaic.org}}

ALGOL 68

| {{yes|{{Y}}}}

|

APL

| {{yes|{{Y}}}}

| Dyalog, ngn and dzaima APL fully support both dfns and tacit functions. GNU APL has rather limited support for dfns.

Assembly languages

| {{no|{{N}}}}

|

AHK

| {{yes|{{Y}}}}

| Since AutoHotkey V2 anonymous functions are supported with a syntax similar to JavaScript.

Bash

| {{partial|{{Y}}}}

| A library has been made to support anonymous functions in Bash.{{cite web|title=Bash lambda|website=GitHub|url=https://github.com/spencertipping/bash-lambda|date=2019-03-08}}

C

| {{no|{{N}}}}

| Support is provided in Clang and along with the LLVM compiler-rt lib. GCC support is given for a macro implementation which enables the possibility of use. See below for more details.

C#

| {{yes|{{Y}}}}

|{{Cite web|last=BillWagner|title=Lambda expressions - C# reference|url=https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/lambda-expressions|access-date=2020-11-24|website=docs.microsoft.com|language=en-us}}

C++

| {{yes|{{Y}}}}

| As of the C++11 standard

CFML

| {{yes|{{Y}}}}

| As of Railo 4,{{cite web|title=Closure support|url=http://www.getrailo.org/index.cfm/whats-up/railo-40-beta-released/features/closures/|access-date=2014-01-05|archive-url=https://web.archive.org/web/20140106031957/http://www.getrailo.org/index.cfm/whats-up/railo-40-beta-released/features/closures/|archive-date=2014-01-06|url-status=dead}} ColdFusion 10{{cite web|title=Whats new in ColdFusion 10|url=https://learn.adobe.com/wiki/display/coldfusionen/Whats+new+in+ColdFusion+10|access-date=2014-01-05|archive-url=https://web.archive.org/web/20140106032853/https://learn.adobe.com/wiki/display/coldfusionen/Whats+new+in+ColdFusion+10|archive-date=2014-01-06|url-status=dead}}

Clojure

| {{yes|{{Y}}}}

|{{Cite web|title=Clojure - Higher Order Functions|url=https://clojure.org/guides/higher_order_functions|access-date=2022-01-14|website=clojure.org}}

COBOL

| {{no|{{N}}}}

| Micro Focus's non-standard Managed COBOL dialect supports lambdas, which are called anonymous delegates/methods.{{cite web | url=http://documentation.microfocus.com/help/topic/com.microfocus.eclipse.infocenter.visualcobol.vs/GUID-DA75663F-6357-4064-8112-C87E7457DE51.html | title=Managed COBOL Reference | publisher=Micro Focus | work=Micro Focus Documentation | access-date=25 February 2014 | archive-url=https://archive.today/20140225190401/http://documentation.microfocus.com/help/topic/com.microfocus.eclipse.infocenter.visualcobol.vs/GUID-DA75663F-6357-4064-8112-C87E7457DE51.html | archive-date=25 February 2014}}

Curl

| {{yes|{{Y}}}}

|

D

| {{yes|{{Y}}}}

|{{Cite web|title=Functions - D Programming Language|url=https://dlang.org/spec/function.html|access-date=2022-01-14|website=dlang.org}}

Dart

| {{yes|{{Y}}}}

|{{Cite web|title=A tour of the Dart language|url=https://dart.dev/guides/language/language-tour|access-date=2020-11-24|website=dart.dev}}

Delphi

| {{yes|{{Y}}}}

|{{Cite web|title=Anonymous Methods in Delphi - RAD Studio|url=http://docwiki.embarcadero.com/RADStudio/Sydney/en/Anonymous_Methods_in_Delphi#:~:text=As%20the%20name%20suggests,%20an,a%20parameter%20to%20a%20method.|access-date=2020-11-24|website=docwiki.embarcadero.com}}

Dylan

| {{yes|{{Y}}}}

|{{Cite web|title=Functions — Dylan Programming|url=https://opendylan.org/books/dpg/func.html|access-date=2022-01-14|website=opendylan.org}}

Eiffel

| {{yes|{{Y}}}}

|

Elm

| {{yes|{{Y}}}}

|{{Cite web|title=docs/syntax|url=https://elm-lang.org/docs/syntax|access-date=2022-01-14|website=elm-lang.org}}

Elixir

| {{yes|{{Y}}}}

|{{Cite web|title=Erlang/Elixir Syntax: A Crash Course|url=https://elixir-lang.org/crash-course.html|access-date=2020-11-24|website=elixir-lang.github.com|language=en}}

Erlang

| {{yes|{{Y}}}}

|{{Cite web|title=Erlang -- Funs|url=https://erlang.org/doc/programming_examples/funs.html|access-date=2020-11-24|website=erlang.org}}

F#

| {{yes|{{Y}}}}

|{{Cite web|last=cartermp|title=Lambda Expressions: The fun Keyword - F#|url=https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/functions/lambda-expressions-the-fun-keyword|access-date=2020-11-24|website=docs.microsoft.com|language=en-us}}

Excel

| {{yes|{{Y}}}}

| Excel worksheet function, 2021 beta release{{Cite web|title=LAMBDA: The ultimate Excel worksheet function

|url=https://www.microsoft.com/en-us/research/blog/lambda-the-ultimatae-excel-worksheet-function/|access-date=2021-03-30|website=microsoft.com|date=25 January 2021|language=en-us}}

Factor

| {{yes|{{Y}}}}

| "Quotations" support this{{cite web|title=Quotations - Factor Documentation|url=http://docs.factorcode.org/content/article-quotations.html|access-date=26 December 2015|quote=A quotation is an anonymous function (a value denoting a snippet of code) which can be used as a value and called using the Fundamental combinators.}}

Fortran

| {{no|{{N}}}}

|

Frink

| {{yes|{{Y}}}}

|{{Cite web|title=Frink|url=https://frinklang.org/|access-date=2020-11-24|website=frinklang.org}}

Go

| {{yes|{{Y}}}}

|{{Cite web|title=Anonymous Functions in GoLang|url=https://golangdocs.com/anonymous-functions-in-golang|access-date=2020-11-24|website=GoLang Docs|date=9 January 2020 |language=en-US}}

Gosu

| {{yes|{{Y}}}}

| {{cite web|title=Gosu Documentation|url=http://gosu-lang.org/doc/pdf/gosuref.pdf|access-date=4 March 2013}}

Groovy

| {{yes|{{Y}}}}

| {{cite web|title=Groovy Documentation|url=http://groovy.codehaus.org/Closures|access-date=29 May 2012|archive-url=https://web.archive.org/web/20120522213410/http://groovy.codehaus.org/Closures|archive-date=22 May 2012|url-status=dead}}

Haskell

| {{yes|{{Y}}}}

|{{Cite web|title=Anonymous function - HaskellWiki|url=https://wiki.haskell.org/Anonymous_function|access-date=2022-01-14|website=wiki.haskell.org}}

Haxe

| {{yes|{{Y}}}}

|{{Cite web|title=Lambda|url=https://haxe.org/manual/std-Lambda.html|access-date=2022-01-14|website=Haxe - The Cross-platform Toolkit}}

Java

| {{yes|{{Y}}}}

| Supported since Java 8.

JavaScript

| {{yes|{{Y}}}}

|{{Cite web|title=Functions - JavaScript {{!}} MDN|url=https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions|access-date=2022-01-14|website=developer.mozilla.org|language=en-US}}

Julia

| {{yes|{{Y}}}}

|{{Cite web|title=Functions · The Julia Language|url=https://docs.julialang.org/en/v1/manual/functions/|access-date=2020-11-24|website=docs.julialang.org}}

Kotlin

| {{yes|{{Y}}}}

|{{Cite web|title=Higher-Order Functions and Lambdas - Kotlin Programming Language|url=https://kotlinlang.org/docs/reference/lambdas.html|access-date=2020-11-24|website=Kotlin|language=en}}

Lisp

| {{yes|{{Y}}}}

|

Logtalk

| {{yes|{{Y}}}}

|

Lua

| {{yes|{{Y}}}}

|{{Cite web|title=Programming in Lua : 6|url=https://www.lua.org/pil/6.html|access-date=2020-11-24|website=www.lua.org}}

MUMPS

| {{no|{{N}}}}

|

Maple

| {{yes|{{Y}}}}

|{{Cite web|title=Maple Programming: 1.6: Anonymous functions and expressions - Application Center|url=https://www.maplesoft.com/applications/view.aspx?sid=1522&view=html|access-date=2020-11-24|website=www.maplesoft.com}}

MATLAB

| {{yes|{{Y}}}}

|{{Cite web|title=Anonymous Functions - MATLAB & Simulink|url=https://www.mathworks.com/help/matlab/matlab_prog/anonymous-functions.html|access-date=2022-01-14|website=www.mathworks.com}}

Maxima

| {{yes|{{Y}}}}

|{{Cite web|title=Maxima 5.17.1 Manual: 39. Function Definition|url=http://maths.cnam.fr/Membres/wilk/MathMax/help/Maxima/maxima_39.html#:~:text=Maxima%20simplifies%20funmake%20%27s%20return%20value.&text=Defines%20and%20returns%20a%20lambda,of%20the%20function%20is%20expr_n%20.|access-date=2020-11-24|website=maths.cnam.fr}}

Nim

| {{yes|{{Y}}}}

|{{Cite web|url=https://nim-lang.github.io/Nim/manual.html#procedures-anonymous-procs|title=Nim Manual|website=nim-lang.github.io}}

OCaml

| {{yes|{{Y}}}}

|{{Cite web|title=Code Examples – OCaml|url=https://ocaml.org/learn/taste.html|access-date=2020-11-24|website=ocaml.org}}

Octave

| {{yes|{{Y}}}}

|{{Cite web|title=GNU Octave: Anonymous Functions|url=https://octave.org/doc/v4.0.1/Anonymous-Functions.html|access-date=2020-11-24|website=octave.org}}

Object Pascal

| {{partial|{{Y}}}}

| Delphi, a dialect of Object Pascal, supports anonymous functions (formally, anonymous methods) natively since Delphi 2009. The Oxygene Object Pascal dialect also supports them.

Objective-C (Mac OS X 10.6+)

| {{yes|{{Y}}}}

| Called blocks; in addition to Objective-C, blocks can also be used on C and C++ when programming on Apple's platform.

OpenSCAD

| {{yes|{{Y}}}}

| Function Literal support was introduced with version 2021.01.{{cite web |title=Function Literals |url=https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/User-Defined_Functions_and_Modules#Function_Literals |website=OpenSCAD User Manual |publisher=Wikibooks |access-date=22 February 2021}}

Pascal

| {{no|{{N}}}}

|

Perl

| {{yes|{{Y}}}}

|{{Cite web|title=perlsub - Perl subroutines - Perldoc Browser|url=https://perldoc.perl.org/perlsub|access-date=2020-11-24|website=perldoc.perl.org}}

PHP

| {{yes|{{Y}}}}

| As of PHP 5.3.0, true anonymous functions are supported.{{Cite web|title=PHP: Anonymous functions - Manual|url=https://www.php.net/manual/en/functions.anonymous.php|access-date=2020-11-24|website=www.php.net}} Formerly, only partial anonymous functions were supported, which worked much like C#'s implementation.

PL/I

| {{no|{{N}}}}

|

Python

| {{partial|{{Y}}}}

| Python supports anonymous functions through the lambda syntax,{{Cite web|title=6. Expressions — Python 3.9.0 documentation|url=https://docs.python.org/3/reference/expressions.html|access-date=2020-11-24|website=docs.python.org}} which supports only expressions, not statements.

R

| {{yes|{{Y}}}}

|

Racket

| {{yes|{{Y}}}}

|{{Cite web|title=4.4 Functions: lambda|url=https://docs.racket-lang.org/guide/lambda.html|access-date=2020-11-24|website=docs.racket-lang.org}}

Raku

| {{yes|{{Y}}}}

|{{Cite web|title=Functions|url=https://docs.raku.org/language/functions|access-date=2022-01-14|website=docs.raku.org}}

Rexx

| {{no|{{N}}}}

|

RPG

| {{no|{{N}}}}

|

Ruby

| {{yes|{{Y}}}}

| Ruby's anonymous functions, inherited from Smalltalk, are called blocks.{{cite web|url=http://www.reactive.io/tips/2008/12/21/understanding-ruby-blocks-procs-and-lambdas/ |title=Understanding Ruby Blocks, Procs and Lambdas |last=Sosinski |first=Robert |publisher=Reactive.IO |date=2008-12-21 |access-date=2014-05-30 |url-status=dead |archive-url=https://web.archive.org/web/20140531123646/http://www.reactive.io/tips/2008/12/21/understanding-ruby-blocks-procs-and-lambdas/ |archive-date=2014-05-31 }}

Rust

| {{yes|{{Y}}}}

| {{Cite web|title=Closures: Anonymous Functions that Can Capture Their Environment - The Rust Programming Language|url=https://doc.rust-lang.org/book/ch13-01-closures.html|access-date=2022-01-14|website=doc.rust-lang.org}}

Scala

| {{yes|{{Y}}}}

|{{Cite web|title=Anonymous Functions|url=https://docs.scala-lang.org/overviews/scala-book/anonymous-functions.html|access-date=2022-01-14|website=Scala Documentation}}

Scheme

| {{yes|{{Y}}}}

|

Smalltalk

| {{yes|{{Y}}}}

| Smalltalk's anonymous functions are called blocks.

Standard ML

| {{yes|{{Y}}}}

|{{Cite web|title=Recitation 3: Higher order functions|url=https://www.cs.cornell.edu/courses/cs312/2008sp/recitations/rec03.html|access-date=2022-01-14|website=www.cs.cornell.edu}}

Swift

| {{yes|{{Y}}}}

| Swift's anonymous functions are called Closures.{{Cite web|url=https://docs.swift.org/swift-book/LanguageGuide/Closures.html|title=Closures — The Swift Programming Language (Swift 5.5)|website=docs.swift.org}}

TypeScript

| {{yes|{{Y}}}}

|{{Cite web|title=Documentation - Everyday Types|url=https://www.typescriptlang.org/docs/handbook/2/everyday-types.html|access-date=2022-01-14|website=www.typescriptlang.org|language=en}}

Typst

| {{yes|{{Y}}}}

|{{Cite web|title=Function Type - Typst Documentation|url=https://typst.app/docs/reference/foundations/function/#unnamed|access-date=2024-09-10|website=typst.app|language=en}}

Tcl

| {{yes|{{Y}}}}

|{{Cite web|title=Projects/Vala/Tutorial - GNOME Wiki!|url=https://wiki.gnome.org/Projects/Vala/Tutorial|access-date=2020-11-24|website=wiki.gnome.org}}

Vala

| {{yes|{{Y}}}}

|

Visual Basic .NET v9

| {{yes|{{Y}}}}

|{{Cite web|last=KathleenDollard|title=Lambda Expressions - Visual Basic|url=https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/lambda-expressions|access-date=2022-01-14|website=docs.microsoft.com|date=15 September 2021 |language=en-us}}

Visual Prolog v 7.2

| {{yes|{{Y}}}}

|{{Cite web|title=Language Reference/Terms/Anonymous Predicates - wiki.visual-prolog.com|url=https://wiki.visual-prolog.com/index.php?title=Language_Reference/Terms/Anonymous_Predicates|access-date=2022-01-14|website=wiki.visual-prolog.com}}

Wolfram Language

| {{yes|{{Y}}}}

|{{Cite web|title=Pure Anonymous Function: Elementary Introduction to the Wolfram Language|url=https://www.wolfram.com/language/elementary-introduction/2nd-ed/26-pure-anonymous-functions.html.en|access-date=2022-01-14|website=www.wolfram.com|language=en}}

Zig

| {{no|{{N}}}}

| {{Cite web |title=Lambdas, Closures and everything in between · Issue #1048 · ziglang/zig |url=https://github.com/ziglang/zig/issues/1048 |access-date=2023-08-21 |website=GitHub |language=en}}

Examples of anonymous functions

{{main|Examples of anonymous functions}}

See also

{{Portal|Computer programming}}

References

{{Reflist|30em}}