diff options
Diffstat (limited to 'lib/Extensions.cs')
-rw-r--r-- | lib/Extensions.cs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Extensions.cs b/lib/Extensions.cs index 3c81f17..a1ffbcc 100644 --- a/lib/Extensions.cs +++ b/lib/Extensions.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; namespace aoc2019.lib @@ -8,13 +7,13 @@ namespace aoc2019.lib { public static IEnumerable<IEnumerable<T>> Permute<T>(this IEnumerable<T> list) { - if (list.Count() == 1) return new[] { list }; + if (list.Count() == 1) return new[] {list}; return list.SelectMany(t => Permute(list.Where(x => !x.Equals(t))), (v, p) => p.Prepend(v)); } public static IEnumerable<string> Chunk(this string str, int chunkSize) { - for (int i = 0; i < str.Length; i += chunkSize) + for (var i = 0; i < str.Length; i += chunkSize) yield return str.Substring(i, chunkSize); } @@ -30,4 +29,4 @@ namespace aoc2019.lib yield return item; } } -} +} \ No newline at end of file |