Share via


Patterns.Lambda Active Pattern (F#)

Recognizes expressions that represent first-class function values.

Namespace/Module Path: Microsoft.FSharp.Quotations.Patterns

Assembly: FSharp.Core (in FSharp.Core.dll)

// Signature:
( |Lambda|_| ) : (input:Expr) -> (Var * Expr) option

Parameters

  • input
    Type: Expr

    The input expression to match against.

Return Value

The formal return type is (Var * Expr) option. The option indicates whether the input results in a match. In a pattern matching expression, the input is decomposed, upon a successful match, into a tuple of two elements. The first element is a Var object that represents a single argument. The second object is an expression that represents the body of the lambda expression. Lambda expressions that have multiple arguments are decomposed one argument at a time. For example, a lambda expression that has two arguments is decomposed so that the Var element is the first argument, and the Expr element is a lambda expression that can be recursively decomposed so that the second-level Var element is the second argument and the second-level Expr element is the body.

Remarks

This function is named LambdaPattern in the .NET Framework assembly. If you are accessing the member from a .NET Framework language other than F#, or through reflection, use this name.

Platforms

Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

Version Information

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

See Also

Reference

Quotations.Patterns Module (F#)

Microsoft.FSharp.Quotations Namespace (F#)