Open GoogleCodeExporter opened 9 years ago
That behavior can be easily emulated using Take together with Count.
AtLeast(int x)=sequence.Take(x).Count()==x
Exactly(int x)=sequence.Take(x+1).Count()==x
Original comment by CodeInCh...@quantentunnel.de
on 2 Mar 2011 at 9:21
Easily emulated, certainly, but not so nice to read. AtLeast and Exactly
provide much clearer intent than Take.Count==.
Original comment by jeffma...@gmail.com
on 26 Jul 2011 at 5:39
Hi. I've been playing with a branch, at taking some of my own
enumeration-focused methods and making those that aren't already covered by
morelinq match the rest of the library. Hopefully you'll find
https://code.google.com/r/jon-morelinq/source/browse/MoreLinq/AtLeast.cs
matches the request here. It also, unlike a combination of .Take() and
.Count(), won't take a O(n) approach when an O(1) approach is available because
the source is an ICollection<T>.
Relatedly,
https://code.google.com/r/jon-morelinq/source/browse/MoreLinq/TakeAtLeast.cs
might be of some interest; lazily executed, it asserts that there will be
atleast a certain number of elements and throws an exception otherwise.
Original comment by j...@hackcraft.net
on 1 Dec 2013 at 11:09
@jon@hackcraft.net Have you considered turning on code review on your clone?
Would help to discuss some things inline.
Original comment by azizatif
on 2 Dec 2013 at 9:33
@azizatif Done. Right now I'm mostly seeing what I have that doesn't duplicate
things here (e.g. I've an .Eat() that's the same as your .Consume() so there's
no need for it), tidying things (the methods I'm adding are a bunch of stuff
that came up over the years, some of which even pre-dates extension methods,
rather than any organised library) and adding tests where I have none, and I
wasn't planning to suggest anything to your project until I'd a bit more done
there. But certainly, reviews are more than welcome, I'm just not familiar with
code.google so didn't know to turn it on until you mentioned. As well as the
two cases mentioned above, you might find the buffering of particular interest,
as it hits two of your TODOs.
Original comment by j...@hackcraft.net
on 5 Dec 2013 at 11:53
This issue has been migrated to:
https://github.com/MoreLINQ/morelinq/issues/58
The conversation continues there.
DO NOT post any further comments to the issue tracker on Google Code as it is
shutting down.
You can also just subscribe to the issue on GitHub to receive notifications of
any further development.
Original comment by azizatif
on 21 Aug 2015 at 6:55
Original issue reported on code.google.com by
jeffma...@gmail.com
on 29 Jan 2010 at 9:28