I wrote this earlier:
```
import std.stdio;
import std.algorithm.searching;
string[] numeric_traits_1 = [];
string[] numeric_traits_2 = ["Two"];
string[] numeric_traits_3 = ["One"];
string[] numeric_traits_4 = ["One", "Two"];
void main() {
void numeric_traits_contains(string[] numeric) {
On Sunday, 5 November 2023 at 18:36:40 UTC, Ctn-Dev wrote:
Is there a more concise way of getting the same result?
Try this:
```d
switch(range.map!(_ => (_== "Two" ? 2 : _=="One" ? 1 :
0)).fold!((a,b) => a | b)(0)) {
case 3: writeln("both"); break;
case 2: writein("only two"); break;
case 1:
On Sunday, 5 November 2023 at 18:36:40 UTC, Ctn-Dev wrote:
I wrote this earlier:
[...]
if runs when both "One" and "Two" are in the given array as
intended, but its conditional statement looks verbose. Is there
a more concise way of getting the same result?
Yes, assuming you accept to drop
On Sunday, 5 November 2023 at 18:36:40 UTC, Ctn-Dev wrote:
I wrote this earlier:
[...]
`if` runs when both "One" and "Two" are in the given array as
intended, but its conditional statement looks verbose. Is there
a more concise way of getting the same result?
If sorting the arrays is an opt