-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Description
Submitted by Alexei Odeychuk on 3/11/2016 12:00:00 AM
4 votes on UserVoice prior to migration
I suggest simplifying syntax for generating sequences. It would be great to make it as simple as syntax for lists in F#.
For example,
let lst = [ 1; 2; 3; 4 ] // allowed
let sq = seq { 1; 2; 3; 4 } // not allowed, why?
// error FS0739: Invalid object, sequence or record expression.
Now, the F# syntax rules allow declaring a simple sequence expression as follows:
let se = seq { yield 1; yield 2; yield 3 }
I think syntax rules may well be simplified in that case. It would be more comfortable for language users to declare sequences with no need to write the yield keyword each time when they specify a new value for the sequence expression.
P.S. At the same time, there is no need to make any improvements in syntax for generating sequences using ranges specified in the form like 1 .. 10.
let lst = [ 1 .. 10 ] // allowed
let sq = seq { 1 .. 10 } // allowed, and that's good!
cloudRoutine, cartermp, Pauan, theprash, Rickasaurus and 2 more