Re:Lisp is sin
by stefano on Tuesday September 01, 2009 @03:13PM
(#798647)
I don't know C#, but it seems to me that your C# version of memoize works only for functions with exactly one argument, while the CL version works for any kind of function.
[ Parent
| on HN ]
Yeaaah.... It turns out that generic methods with variable arity is a sore spot for the .NET type system. The C# and F# teams are quite aware.
The typical/recommended/easy/practical solution is to just provide another overload, pack the args into an object array, and then call the original overload; completely ignoring the problem.
Alternatively, you could do some scary things with reflection...