Skip to content

Instantly share code, notes, and snippets.

@chrisza4
Created May 5, 2020 15:45
Show Gist options
  • Select an option

  • Save chrisza4/4d7aeaf54d09dad475a2295efecd0af4 to your computer and use it in GitHub Desktop.

Select an option

Save chrisza4/4d7aeaf54d09dad475a2295efecd0af4 to your computer and use it in GitHub Desktop.
class IEnumerable<T>
{
private List<T> data;
public T Where((func T => bool) filterFunc)
{
for (var d in data) {
if (filterFunc(d)) return d;
}
return null;
}
}
@chrisza4

chrisza4 commented May 5, 2020

Copy link
Copy Markdown
Author
function isEvenInteger(int i) {
  return i  % 2;
}

function isEvenFloat(float i) {
  return i % 2;
}
new Enumerable<int>().Where(isEvenInteger)  // Passed
new Enumerable<int>().Where(isEventFloat)  // FAiled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment