[英]Difference between #seq and seq in F#
I was wondering what #seq means in the F# interactive shell. I had a collect
function with 2 parameters, a function and a sequence, where this function is applied to the sequence.我想知道 #seq 在 F# 交互式 shell 中意味着什么。我有一个带有 2 个参数的
collect
function,一个 function 和一个序列,其中这个 function 应用于序列。
let rec collect f sq =
seq {
let a = Seq.item 0 sq
let sq1 = Seq.skip 1 sq
let ris = f a
yield! ris
yield! collect f sq1
}
When the shell evaluates the collect
it gives back the following signature当 shell 评估
collect
时,它返回以下签名
val collect: f: ('a -> #seq<'c>) -> sq: seq<'a> -> seq<'c>
What does #
mean before seq
in this instance?在这种情况下,
seq
之前的#
是什么意思?
seq<'a>
is the F# spelling for IEnumerable<T>
seq<'a>
是IEnumerable<T>
的 F# 拼写#
before a type is a flexible type annotation .#
是灵活的类型注释。 This allows you to use any type that implements the indicated interface.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.