Bagikan melalui


Operators.( <|| )<'T1,'T2,'U> Function (F#)

Apply a function to two values, the values being a pair on the right, the function on the left

Namespace/Module Path: Microsoft.FSharp.Core.Operators

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

// Signature:
( <|| ) : ('T1 -> 'T2 -> 'U) -> 'T1 * 'T2 -> 'U

// Usage:
func <|| (arg1, arg2)

Parameters

  • func
    Type: 'T1 -> 'T2 -> 'U

    The function.

  • arg1
    Type: 'T1

    The first argument.

  • arg2
    Type: 'T2

    The second argument.

Return Value

The function result.

Example

The following example demonstrates the use of the <|| operator.

let append string1 string2 = string1 + "." + string2

let result1 = append <|| ("abc", "def")
printfn "append <|| (\"abc\", \"def\") gives %A" result1

let toUpper (string1:string) (string2:string) = string1.ToUpper(), string2.ToUpper()

// Reverse pipelines require parentheses.
let result2 = append <|| (toUpper <|| ("abc", "def"))

printfn "result2: %A" result2
append <|| ("abc", "def") gives "abc.def"
result2: "ABC.DEF"

Platforms

Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2

Version Information

F# Runtime

Supported in: 2.0, 4.0

Silverlight

Supported in: 3

See Also

Reference

Core.Operators Module (F#)

Microsoft.FSharp.Core Namespace (F#)