Closed DavidArno closed 7 years ago
Marking this as a breaking change as I'm removing public static ConsResult<T> Cons<T>(this IEnumerable<T> collection)
and replacing it with the deconstruct. ConsResult<T> Cons
will still exist for IConsEnumerable
though.
Included in the v3.0.0 release.
Currently, Succinc<T> can be used to split an
IEnumerable<T>
into a head and tail via the following method:With C# 7 deconstruction though, a simple
Deconstruct
extension method onIEnumerable<T>
would not only allow the above to be written as:But also, a deconstruction can be recursive, so to extract the first three items from a list and have
tail
represent the fourth onwards elements, the code would simply be:Modify Succinc<T> to support this.