I write my own reimplementation of LINQ using F# (thanks to Jon Skeet for inspiration).
I use a trick to generate empty sequence:
let empty<'b> =
seq {
for n = 0 to -1 do
yield Unchecked.defaultof<'b>
}
printfn "%A" empty<int> // -> seq []
Is there any idiomatic approach to do this?
(Seq.empty is not useful, I'm just reimplementing it)
Seq.emptynot usefull while theseqbuilder is? Anyway you can always use an object-expression that returns anIEnumerable<'b>which returns emptyIEnumerator<'b>s[] :> 'a seqor[||] :> 'a seqor anything similiar ;)