Created
June 23, 2014 05:07
-
-
Save hidori/47e12142431579a79c5f to your computer and use it in GitHub Desktop.
Scala っぽいやつ
This file contains 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 static class Scala | |
{ | |
public static Func<T, V> Compose<T, U, V>(this Func<U, V> first, Func<T, U> second) | |
{ | |
if (first == null) throw new ArgumentNullException("first"); | |
if (second == null) throw new ArgumentNullException("second"); | |
return t => first(second(t)); | |
} | |
public static Func<T, V> AndThen<T, U, V>(this Func<T, U> first, Func<U, V> second) | |
{ | |
if (first == null) throw new ArgumentNullException("first"); | |
if (second == null) throw new ArgumentNullException("second"); | |
return t => second(first(t)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment