- Apr 15, 2005
I covered Trampolines in this post; not to the full extent of what I explain, but this example, does cover standard recursion using trampolines (Sorry code is in Swift) https://mybroadband.co.za/vb/showthread.php/855900-Whiteboard-Challenges?p=18749328&viewfull=1#post18749328^ Ok, lost me there
/Edit what I failed to mention is that with this type of approach the function arity is usually kept to a minimum: 1 value in, 1 value out -- because the typing of this can get complex rather quickly. This is also where currying and partial application simplify things a lot.
PS. C# 7 is introducing both tuples and pattern matching so most of the Swift code should easily translate. Although it's certainly quite possible to do that with C# 6, maybe just not as elegant.