-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Description
I propose we make this consistent:
let f = Seq.head
let a = f { 1..6 }
let b = f { 1; 2 } // error FS0740: Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'
Now we don't have to allocate entire lists or arrays just to make sets.
let a = set { 1..6 }
let b = set { 1; 2 } // error FS0740: Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'
The existing way of approaching this problem in F# is
let a = set { 1..6 }
let b = set (seq { 1; 2 })
Pros and Cons
The advantages of making this adjustment to F# are
- Consistency
- Convenience
- Less allocation
The disadvantage of making this adjustment to F# is that this may cause confusion as set
here isn't a computation expression. However, syntax can be quickly learnt.
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions: (put links to related suggestions here)
Affidavit (please submit!)
Please tick this by placing a cross in the box:
- This is not a question (e.g. like one you might ask on stackoverflow) and I have searched stackoverflow for discussions of this issue
- I have searched both open and closed suggestions on this site and believe this is not a duplicate
- This is not something which has obviously "already been decided" in previous versions of F#. If you're questioning a fundamental design decision that has obviously already been taken (e.g. "Make F# untyped") then please don't submit it.
Please tick all that apply:
- This is not a breaking change to the F# language design
- I or my company would be willing to help implement and/or test this
For Readers
If you would like to see this issue implemented, please click the 👍 emoji on this issue. These counts are used to generally order the suggestions by engagement.