I am trying to do some list comprehension in F#. And I found this.
let evens n =
{ for x in 1 .. n when x % 2 = 0 -> x }
print_any (evens 10)
let squarePoints n =
{ for x in 1 .. n
for y in 1 .. n -> x,y }
print_any (squarePoints 3)
The first still works ok, but the second is outdated. The latest (1.9.7.8) F# compiler does not support this style.
After some search I found this works
let vec1 = [1;2;3]
let vec2 = [4;5;6]
let products = [for x in vec1 do for y in vec2 do yield x*y]
Can someone point why the syntax changed? Thanks.