Operators.( >> )<'T1,'T2,'T3>-Funktion (F#)
Verfasst zwei Funktionen, wobei die Funktion auf der linken Seite zuerst angewendet wird.
Namespace/Modulpfad: Microsoft.FSharp.Core.Operators
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature:
( >> ) : ('T1 -> 'T2) -> ('T2 -> 'T3) -> 'T1 -> 'T3
// Usage:
func1 >> func2
Parameter
func1
Typ: 'T1 -> 'T2Die erste anzuwendende Funktion.
func2
Typ: 'T2 -> 'T3Die zweite anzuwendende Funktion.
Rückgabewert
Die Komposition der Eingabefunktionen.
Beispiel
Das folgende Beispiel veranschaulicht die Verwendung des Kompositionsoperators (>>).
let append1 string1 = string1 + ".append1"
let append2 string1 = string1 + ".append2"
// Composition of two functions.
let appendBoth = append1 >> append2
printfn "%s" (appendBoth "abc")
// Composition of three functions.
let append3 string1 = string1 + ".append3"
printfn "%s" ((append1 >> append2 >> append3) "abc")
// Composition of functions with more than one parameter.
let appendString (string1:string) (string2:string) = string1 + string2
let appendFileExtension extension =
appendString "." >> appendString extension
printfn "%s" (appendFileExtension "myfile" "txt")
Plattformen
Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2
Versionsinformationen
F#-Kern-Bibliotheks-Versionen
Unterstützt in: 2,0, 4,0, portablen