Created
November 7, 2018 07:45
-
-
Save lonewolfwilliams/69181a2a1475694aaeef77883cfafc50 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 interface ITuple //like a maybe | |
| { | |
| ITuple Add<T>(T item); | |
| } | |
| public class Tuple : ITuple //like a nothing | |
| { | |
| public ITuple Add<T>(T item) | |
| { | |
| return new Tuple<T>(item); | |
| } | |
| } | |
| public class Tuple<A> : ITuple //like a something | |
| { | |
| public A itemOne; | |
| public Tuple(A item) | |
| { | |
| itemOne = item; | |
| } | |
| public ITuple Add<B>(B item) | |
| { | |
| return new Tuple<A,B>(itemOne, item); | |
| } | |
| } | |
| public class Tuple<A,B> : ITuple | |
| { | |
| public A itemOne; | |
| public B itemTwo; | |
| public Tuple(A itemOne, B itemTwo) | |
| { | |
| this.itemOne = itemOne; | |
| this.itemTwo = itemTwo; | |
| } | |
| public ITuple Add<C>(C item) | |
| { | |
| return new Tuple<A,B,C>(itemOne,itemTwo,item); | |
| } | |
| } | |
| public class Tuple<A,B,C> : ITuple | |
| { | |
| public A itemOne; | |
| public B itemTwo; | |
| public C itemThree; | |
| public Tuple(A itemOne, B itemTwo, C itemThree) | |
| { | |
| this.itemOne = itemOne; | |
| this.itemTwo = itemTwo; | |
| this.itemThree = itemThree; | |
| } | |
| public ITuple Add<D>(D item) | |
| { | |
| return new Tuple<A,B,C,D>(itemOne,itemTwo,itemThree,item); | |
| } | |
| } | |
| public class Tuple<A,B,C,D> : ITuple | |
| { | |
| public A itemOne; | |
| public B itemTwo; | |
| public C itemThree; | |
| public D itemFour; | |
| public Tuple(A itemOne, B itemTwo, C itemThree, D itemFour) | |
| { | |
| this.itemOne = itemOne; | |
| this.itemTwo = itemTwo; | |
| this.itemThree = itemThree; | |
| } | |
| public ITuple Add<E>(E item) | |
| { | |
| return this; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment