Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP simplify collections #1

Open
9 of 19 tasks
ranma42 opened this issue Sep 19, 2024 · 0 comments
Open
9 of 19 tasks

WIP simplify collections #1

ranma42 opened this issue Sep 19, 2024 · 0 comments

Comments

@ranma42
Copy link
Owner

ranma42 commented Sep 19, 2024

source.Where(p).OrderBy(s).Skip(o).Take(l)

  • source.Skip(0) -> source

  • source.Where(true) -> source

  • source.Take(0).* -> source.Take(0)

  • source.Take(0) -> whatever.Take(0)

  • source.Where(false) -> source.Take(0)

  • source.Where(x).Where(y) -> source.Where(x && y)

  • source.Take(x).Take(y) -> source.Take(Min(x, y))

  • source.Skip(x).Skip(y) -> source.Skip(Max(x, 0) + Max(y, 0))

  • source.Take(x).Skip(y) -> source.Skip(y).Take(Max(x, 0) - Max(y, 0))

  • unorderedSource.Reverse() -> unorderedSource

  • source.OrderBy(x).Reverse() -> source.OrderBy(-x)

  • source.LastOrDefault() -> source.TakeLast(1) -> source.Reverse().Take(1)

  • source.TakeLast(y) -> source.Reverse().Take(y).Reverse()

  • source.Distinct().Take(1) -> source.Take(1)

  • source.Take(1).Distinct() -> source.Take(1)

  • source.Take(1).OrderBy(x) -> source.Take(1)

  • source.Take(1).Reverse(x) -> source.Take(1)

  • source.OrderBy(x).OrderBy(y) -> source.OrderBy(y)

  • source.OrderBy(x).Where(y) -> source.Where(y).OrderBy(x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant