Skip to content

Exploring matching the head and tail of an enumerable in C#

Notifications You must be signed in to change notification settings

banbh/enumerable-head-tail

Repository files navigation

Enumerables, Heads, Tails, and a Prime Sieve

Explore matching potentially infinite enumerables on head and tail, and apply it to the Sieve of Eratosthenes.

This is discussed in an answer on SO where the shortcomings of this approach are discussed. One problem in particular is that the tail should be another enumerable, but the natural way to do see is wasteful (see HeadTailWasteful) in this repo. It would be more efficient to make the tail an enumerator (rather than an enumerable) but this makes it hard to process using LINQ-type methods. A half-way house is to turn the enumerator into an enumerable which makes processing it easier but results in an enumerable which doesn't really behave the way one would expect.

About

Exploring matching the head and tail of an enumerable in C#

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages