Coding Challenges - Dlang or Generic

drug007 drug2004 at bk.ru
Tue Jan 10 11:25:47 UTC 2023


10.01.2023 14:23, drug007 пишет:
> 10.01.2023 13:57, matheus пишет:
>> On Tuesday, 10 January 2023 at 05:21:15 UTC, H. S. Teoh wrote:
>>>
>>> Printing it in this format is trivial, and not very interesting.  The 
>>> interest in the challenge is to lay it out like I posted, 
>>> side-by-side,...
>>
>> Like I said I did it over D online compiler which unfortunately I 
>> couldn't validate the output because it "wraps" the text, and the font 
>> wasn't monospace.
>>
>> But It just a case of changing the loop in a way to print 3 groups of 
>> months.
>>
>>> ... and to do so in a way that the code is clean, maintainable, and 
>>> consists of reusable components. ...
>>
>> Talking about modularity and reusable components, I really think it 
>> depends, because if that's was really the case, then I would think of 
>> using the OS functions to move the cursor around (If console/terminal) 
>> to print a given month in some location or side by side until reach 
>> some horizontal limit (Terminal), then it could be 1 column only (Like 
>> I did), 2, 3 and maybe 4 columns if the terminal/resolution permit, 
>> and for that I would use ARSD. :]
>>
>> But I think this would be too much for this kind of thing writing on 
>> online compiler.
>>
>>> ... That's where the challenge lies.
>>
>> To be honest when I saw your proposal, I really thought that the real 
>> challenge would be to write my own algo to handle the date, and I was 
>> pretty sure after posting above, you would say that, but not about the 
>> layout or printing in groups. =]
>>
>> Matheus.
> 
> [To clarify the 
> situation](https://wiki.dlang.org/Component_programming_with_ranges)
> (H S Teoh is the author of this article)

Also I'd like to add that this article inspired Eric Niebler to write 
ranges for C++. Now C++ has already 3rd version of ranges and they are 
still not used in general.


More information about the Digitalmars-d-learn mailing list