Created
February 24, 2011 10:44
-
-
Save ilkerde/842040 to your computer and use it in GitHub Desktop.
A quick, unprofessional and not too serious draft for a triple plus operator in C# :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void TriplePlus() | |
{ | |
int coffee = 0; | |
// constant linear growth by 1 on every access until reset | |
IEnumerable<int> drink = coffee+++; | |
var enjoy = | |
from slurp in drink | |
where slurp <= 100 | |
&& slurp % 3 == 0 | |
select "nomnom"; | |
// reset by setting it. | |
coffee = 0; | |
// iterator is done. | |
drink.Any() == false; | |
} | |
public IEnumerable<int> TriplePlusPerformsARange(int from, int to) | |
{ | |
return (int coffee+++) | |
.Where(slurp => slurp >= from && slurp <= to); | |
} | |
public bool TriplePlusPerformsStepping() | |
{ | |
return (int coffee+++2) | |
.All(slurp => slurp % 2 == 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment