Funzione Operators.( >> )<'T1,'T2,'T3> (F#)
Consente di combinare due funzioni, di cui la funzione sulla sinistra viene applicata per prima
Percorso spazio dei nomi/modulo: Microsoft.FSharp.Core.Operators
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature:
( >> ) : ('T1 -> 'T2) -> ('T2 -> 'T3) -> 'T1 -> 'T3
// Usage:
func1 >> func2
Parametri
func1
Tipo: 'T1 -> 'T2Prima funzione da applicare.
func2
Tipo: 'T2 -> 'T3Seconda funzione da applicare.
Valore restituito
Composizione delle funzioni di input.
Esempio
Nell'esempio seguente viene illustrato l'utilizzo dell'operatore di composizione (>>).
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")
Piattaforme
Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2.
Informazioni sulla versione
F# Runtime
Supportato in: 2.0, 4.0
Silverlight
Supportato in: 3