Re: How can I make a nested array and flatten it at run time in D?

2019-03-07 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Mar 08, 2019 at 01:00:43AM +, Philos Kim via Digitalmars-d-learn wrote: > I want to make a nested array and flatten it at run-time like this. > > auto nestedArray = [1, 2, [3, 4], 5]; You can't write it this way because the nested array has a different type from the other elements.

Re: How can I make a nested array and flatten it at run time in D?

2019-03-07 Thread James Blachly via Digitalmars-d-learn
On 3/7/19 8:00 PM, Philos Kim wrote: I want to make a nested array and flatten it at run-time like this. auto nestedArray = [1, 2, [3, 4], 5]; auto flattenedArray = myFun(nestedArray); writeln(flattenedArray);   // => [1, 2, 3, 4, 5] How can I do this in D? Please help me out! There are

How can I make a nested array and flatten it at run time in D?

2019-03-07 Thread Philos Kim via Digitalmars-d-learn
I want to make a nested array and flatten it at run-time like this. auto nestedArray = [1, 2, [3, 4], 5]; auto flattenedArray = myFun(nestedArray); writeln(flattenedArray); // => [1, 2, 3, 4, 5] How can I do this in D? Please help me out!