Disclaimer: Total F# Newbie question!
If I type the following into an F# file in Visual Studio
#light
let squares =
seq { for x in 1 .. 10 -> x * x }
printf "%A" squares
and run F# interactive on it by highlighting and pressing Alt+Enter, the output in the interactive window is
>
seq [1; 4; 9; 16; ...]
val squares : seq<int>
>
But I want to see the full sequence i.e.
>
seq [1; 4; 9; 16; 25; 36; 49; 64; 81; 100]
val squares : seq<int>
>
Is this possible? I'm hoping that there is a setting for this that I've missed.
Best Answer
'seq' is a lazily-evaluated construct; it could be infinite, which is why FSI only shows the first few values. If you want to see it all, an easy thing to do is convert to a list, e.g.