May 25, 2018
On Friday, 25 May 2018 at 03:34:43 UTC, IntegratedDimensions wrote:
> On Friday, 25 May 2018 at 02:43:39 UTC, Jordan Wilson wrote:
>> On Thursday, 24 May 2018 at 23:22:56 UTC, IntegratedDimensions wrote:
>>> [...]
>>
>> 3rd outcome: noobs like me who read the forums who benefit from such discussion.
>>
>> Of course, you could be as disinterested in the 3rd outcome as you are the 1st and 2nd, and that's completely fair.
>>
>> Jordan
>

>
> So, I will solve the homework problem for you:
>
> auto max(T)(T t)
> {
>   baseTypeOf(T) a;
>   foreach(a; t)
>      a = max(a,t)
>   return a;
> }
>
> max(3) = 3
> max([3,4,5]) = 5
>


you didnt take your time to give a proper example. That code is wrong in multiple ways. People would have to reconstruct your code
May 25, 2018
On Thursday, 24 May 2018 at 22:43:00 UTC, IntegratedDimensions wrote:
> Doesn't make any sense?
>
> foreach(a; x)
>
> if x is not an array then a = x and the loop reduces simply and function to the case it is not so their can be no harm.
>
> It unifies the concepts so that one does not have to worry if x is an array or not and can offer no harm since when x is not an array everything simply reduces to an an alias of x.

please look at opApply.
1 2
Next ›   Last »