On 1/31/26 7:36 AM, kdevel wrote: >> > auto list = fail >> > ? typeof(someExpensiveOperation()).init >> > : someExpensiveOperation();
That works because in this simple code, which was to-me-clearly was an example to show the issue, someExpensiveOperation() does not take any parameters. That's why you can write that code in that "less complex" way. Can you do that without repetition when someExpensiveOperation() e.g. includes passed in parameters?
I don't see how. That's why I used the method I proposed: it's a general solution.
> If you read the code again you'll spot filterFunc and mapFunc in the > return statement. My bad. > But the code is less complex than code with a lambda/nested > function while sharing the same repetitiveness and the same result. Only in example code, not in the general case. >> The problem is, one has to repeat filterFunc and mapFunc as well. And >> that's why a nested function solves the repetition issue elegantly for >> me. > > I don't understand the connection between the last two sentences. I don't think so. > Please, can you rephrase? No. Ali
