I understand the tick to signify a generic parameter, as in:
Seq.append : seq<'T> -> seq<'T> -> seq<'T>
but what does the caret signify, as in:
Seq.average : seq<^T> -> ^T
The detailed signature is:
Seq.average : seq<^T> -> ^T (requires ^T with static member (+) and ^T with static member DivideByInt and ^T with static member Zero)
Unlike Seq.append
, Seq.average needs some more constraints on type of elements. Particularly:
_ DivideByInt (s1 + s2 + ... + sn) n where n <> 0
Seq.average {s1; s2;...; sn} = /
\_ ^T.Zero where n = 0
As you can see, both (+)
, DivideByInt
and Zero
are required in order that Seq.average<^T>
makes sense.
Useful information about generics could be found hereMSDN.