If papply returns a function of less arity than an input function, is there a similar FP operation with returns a function which returns a value regardless of the value of the input function? If so, is there a C# equivalent?
Consider a C# function that returns void
which you want to convert into an expression, and you've done this many many times by writing an anonymous function wrapper like (args) => f(args); return null;
.
In C#,
public Func<T1, T2, ..., T8, TResult> WhatIsMyName<T1, T2, ..., T8, TResult> (Action<T1, T2, ..., T8> action, TResult value = default(TResult))
{
return (t) => { action(t); return value; }
}
which you would ideally call like FP.WhatIsMyName(voidfunc)
and so avoid having to cast.
In Clojure,
(defn whatismyname? [f x]
(f)
x)