Why is D unpopular, redux.

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sat May 28 19:30:42 UTC 2022


On Saturday, 28 May 2022 at 18:15:10 UTC, Ola Fosheim Grøstad 
wrote:
> On Saturday, 28 May 2022 at 17:32:04 UTC, IGotD- wrote:
>> Folding in C++ is perhaps "powerful" but at the same time 
>> unreadable.
>
> I find it to be quite limited, but also confusing for the 
> reader:

Two nested folds (nested loops):


```
template<int... as, int... bs>
void f(std::integer_sequence<int, as...> 
_1,std::integer_sequence<int, bs...> _2) {

     std::cout << ([](auto x){ return ((bs+x) * ...);}(as) + ...) 
<< std::endl;

}


int main()
{
     f(std::integer_sequence<int,1,2,4>{}, 
std::integer_sequence<int,1,-1>{});
     return 0;
}
```

How many seconds do you need to understand what goes on?

(Maybe it would be better to just implement Lisp.)




More information about the Digitalmars-d mailing list