Permalink
Browse files

Get rid of Utility.Scan

For our purposes, it is entirely equivalent to Aggregate.
  • Loading branch information...
1 parent caa21bc commit 941e78b91d235d73af57ec0b5712056f68ca4a55 @aroben aroben committed May 24, 2012
Showing with 1 addition and 13 deletions.
  1. +1 −13 Akavache/Utility.cs
View
@@ -82,7 +82,7 @@ public static IObservable<FileStream> SafeOpenFileAsync(string path, FileMode mo
public static void CreateRecursive(this DirectoryInfo This)
{
- This.FullName.Split(Path.DirectorySeparatorChar).Scan("", (acc, x) =>
+ This.FullName.Split(Path.DirectorySeparatorChar).Aggregate("", (acc, x) =>
{
var path = Path.Combine(acc, x);
@@ -100,18 +100,6 @@ public static void CreateRecursive(this DirectoryInfo This)
});
}
- public static TAcc Scan<T, TAcc>(this IEnumerable<T> This, TAcc initialValue, Func<TAcc, T, TAcc> accFunc)
- {
- TAcc acc = initialValue;
-
- foreach (var x in This)
- {
- acc = accFunc(acc, x);
- }
-
- return acc;
- }
-
public static IObservable<T> LogErrors<T>(this IObservable<T> This, string message = null)
{
return Observable.Create<T>(subj =>

0 comments on commit 941e78b

Please sign in to comment.