On Saturday, 10 March 2018 at 20:48:06 UTC, Nordlöw wrote:
If I have a function
bool f(Rs...)(Rs rs)
is it somehow possible to map and forward all its arguments
`rs` to another function
bool g(Rs...)(Rs rs);
through a call to some map-and-forward-like-function
`forwardMap` in something like
bool f(Rs...)(Rs rs)
{
alias someArbitraryFun = _ => _;
return g(forwardMap!(someArbitraryFun)(rs));
}
?
What should the definition of forwardMap look like?
Does Phobos contain something like this already?
Not sure whether I understand what you are looking for, but
std.functional is your friend here I think pipe/compose is the
function you are searching for.
https://dlang.org/phobos/std_functional.html#forward
https://dlang.org/phobos/std_functional.html#partial
https://dlang.org/phobos/std_functional.html#pipe