function argument for map: why shorter form does not compile?

monkyyy crazymonkyyy at gmail.com
Sun Jun 21 00:04:38 UTC 2026


On Saturday, 20 June 2026 at 12:10:47 UTC, Nick Treleaven wrote:
>
> Perhaps file an issue:
> https://github.com/dlang/phobos/issues

bad take, this is everywhere in the language

at best maybe someone could figure out how to make a 
`staticCurry` work but Im not sure even that is possible to make 
robust

```d
import std;
template staticCurry(alias F,Args...){
template staticCurry(S...){
	auto staticCurry(T...)(T t)=>F!(Args,S)(t);
}}
void main ()
{
	auto a = [1, 2, 3];
	auto b = a.map !(x => format !("%d") (x));  // ok
	auto c = a.map !(staticCurry!(format,"%d"));
	c.writeln;
	alias curry=staticCurry!format;
	auto d=a.map!(curry!"%d");
	d.writeln;
}
```

(getting this to work with ref and attributes would be a 
nightmere)


More information about the Digitalmars-d-learn mailing list