Idea 11462964: Introduce array spread operator for pattern matching and []
Status : declined
Submitted by Ryan Riley on 1/15/2016 12:00:00 AM
18 votes
Several languages have introduced a handy spread operator, ..., that can be used to pick up remaining arguments to a function call or when destructuring values. [1] This would be incredibly helpful in F# to reduce boilerplate in methods accepting a [] or when trying to pattern match arrays:
match [|1;2;3;4|] with
| [||] -> // do stuff with empty array
| [|hd;…tl|] -> // do stuff with hd/tl
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator
Idea 11462964: Introduce array spread operator for pattern matching and []
Status : declined
Submitted by Ryan Riley on 1/15/2016 12:00:00 AM
18 votes
Several languages have introduced a handy spread operator, ..., that can be used to pick up remaining arguments to a function call or when destructuring values. [1] This would be incredibly helpful in F# to reduce boilerplate in methods accepting a [] or when trying to pattern match arrays:
match [|1;2;3;4|] with
| [||] -> // do stuff with empty array
| [|hd;…tl|] -> // do stuff with hd/tl
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator