public static TResult Bounce <TResult>(this Trampoline <TResult> trampoline)
        {
            object result;
            RecursionModifier <TResult> recursiveFunc = null;

            for (
                recursiveFunc = () => recursiveFunc;                       // no arguments

                !ResultsByDelegate.TryGetValue(recursiveFunc, out result); // exit if results exist for the function

                recursiveFunc = trampoline(recursiveFunc)()                // call recursion
                )
            {
            }

            ResultsByDelegate.Remove(recursiveFunc);
            return((TResult)result);
        }
        public static TResult Bounce <T1, TResult>(this Trampoline <T1, TResult> trampoline, T1 inputValue)
        {
            object result;
            RecursionModifier <T1, TResult> recursiveFunc = null;

            recursiveFunc = input =>
            {
                inputValue = input;
                return(recursiveFunc);
            };

            while (!ResultsByDelegate.TryGetValue(recursiveFunc, out result))
            {
                recursiveFunc = trampoline(recursiveFunc)(inputValue);
            }
            ResultsByDelegate.Remove(recursiveFunc);
            return((TResult)result);
        }
        public static TResult Bounce <T1, T2, TResult>(this Trampoline <T1, T2, TResult> trampoline, T1 inputValue1, T2 inputValue2)
        {
            object result;
            RecursionModifier <T1, T2, TResult> recursiveFunc = null;

            for (
                recursiveFunc = (input1, input2) =>
            {
                inputValue1 = input1;                         // let the argument change
                inputValue2 = input2;
                return(recursiveFunc);
            };

                !ResultsByDelegate.TryGetValue(recursiveFunc, out result);          // exit if results exist for the function

                recursiveFunc = trampoline(recursiveFunc)(inputValue1, inputValue2) // call recursion
                )
            {
            }

            ResultsByDelegate.Remove(recursiveFunc);
            return((TResult)result);
        }
 public static RecursionModifier <T1, T2, TReturn> Break <T1, T2, TReturn>(this RecursionModifier <T1, T2, TReturn> f, TReturn result)
 {
     ResultsByDelegate[f] = result;
     return(f);
 }