partial with struct

Salih Dincer salihdb at hotmail.com
Tue Dec 10 19:59:59 UTC 2024


On Tuesday, 10 December 2024 at 19:43:58 UTC, Salih Dincer wrote:
>
> ```d
>   auto nums = [
>          "zero", "one", "two", "six", "ten",
>          "Twenty", "Thirty"
>   ];
>   alias foo = partial!(S.filter, nums);
>   foo('t').writeln; // okay
>   #line 1
>   //foo!(true)('t').writeln; //compile error
> ```


I figured it out, but it's not sense! Because as the number of 
overload functions increases, side effects will occur. Moreover, 
it is very ugly:

```d
   alias foo(bool B = false) = partial!(S.filter!B, nums);
   foo!true('t').writeln; // ["Twenty", "Thirty"]
```

SDB at 79




More information about the Digitalmars-d-learn mailing list