我有一个代码:
seq {for i in [1 .. 100000000] -> i} |> Seq.take 100000;;
Real: 00:00:00.000, CPU: 00:00:00.000, GC gen0: 0, gen1: 0, gen2: 0
val it : seq<int> =
Error: Exception of type 'System.OutOfMemoryException' was thrown.
Run Code Online (Sandbox Code Playgroud)
此代码导致内存不足.为什么?为什么在计算时间后(操作完成后)会抛出异常?AFAIK,个别序列元素仅在需要时计算?