January 10, 2023
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)
January 10, 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.
January 10, 2023
On Tuesday, 10 January 2023 at 11:23:15 UTC, drug007 wrote:
> 10.01.2023 13:57, matheus пишет:
> ...
> [To clarify the situation](https://wiki.dlang.org/Component_programming_with_ranges)
> (H S Teoh is the author of this article)

Hmm very interesting (I'm at work and I just gave it a glimpse). But since I'm a C programmer who just play with D as hobby I would need more time to digest it.

I'll try to read it later.

Matheus.
January 10, 2023

On Tuesday, 10 January 2023 at 10:58:37 UTC, matheus wrote:

>

On Tuesday, 10 January 2023 at 07:38:31 UTC, Salih Dincer wrote:

>

You don't need validDate. Because there is daysInMonth:

That's really better. thanks for the info.

Actually, I should thank you. When I first wrote these codes, I couldn't shorten them that much. Because I've done fun things like this. I think you will like EnumPrint():

    auto enumPrint(T)(size_t len = 0)
    {
      int[string] result; int i = 1;
      for(T x = T.min; x <= T.max; x++)
      {
        result[len ? x.to!string[0..len]
                   : x.to!string] = i++;
      }
      return result;
    }
    enumPrint!DayOfWeek(3).writeln;
}

Thank you...

SDB@79

January 10, 2023

On Tuesday, 10 January 2023 at 01:22:33 UTC, H. S. Teoh wrote:

>

Here's a challenge. Given an input year, for example, "2023", write a program that outputs (for the corresponding year):

--------------------------------snip---------------------------------
2023
January February March
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7 1 2 3 4 1 2 3 4
8 9 10 11 12 13 14 5 6 7 8 9 10 11 5 6 7 8 9 10 11
15 16 17 18 19 20 21 12 13 14 15 16 17 18 12 13 14 15 16 17 18
22 23 24 25 26 27 28 19 20 21 22 23 24 25 19 20 21 22 23 24 25
29 30 31 26 27 28 26 27 28 29 30 31

    April                  May                  June

Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 1 2 3 4 5 6 1 2 3
2 3 4 5 6 7 8 7 8 9 10 11 12 13 4 5 6 7 8 9 10
9 10 11 12 13 14 15 14 15 16 17 18 19 20 11 12 13 14 15 16 17
16 17 18 19 20 21 22 21 22 23 24 25 26 27 18 19 20 21 22 23 24
23 24 25 26 27 28 29 28 29 30 31 25 26 27 28 29 30
30

    July                 August               September

Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 1 2 3 4 5 1 2
2 3 4 5 6 7 8 6 7 8 9 10 11 12 3 4 5 6 7 8 9
9 10 11 12 13 14 15 13 14 15 16 17 18 19 10 11 12 13 14 15 16
16 17 18 19 20 21 22 20 21 22 23 24 25 26 17 18 19 20 21 22 23
23 24 25 26 27 28 29 27 28 29 30 31 24 25 26 27 28 29 30
30 31

   October              November              December

Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7 1 2 3 4 1 2
8 9 10 11 12 13 14 5 6 7 8 9 10 11 3 4 5 6 7 8 9
15 16 17 18 19 20 21 12 13 14 15 16 17 18 10 11 12 13 14 15 16
22 23 24 25 26 27 28 19 20 21 22 23 24 25 17 18 19 20 21 22 23
29 30 31 26 27 28 29 30 24 25 26 27 28 29 30
31
--------------------------------snip---------------------------------

Code will be graded on readability, unittest coverage, and reusability (how many functions have wide applicability outside of this challenge).

;-)

T

import std.process, std.stdio;

void main() {
	writeln(executeShell("cal -y 2023").output);
}
January 10, 2023

On Tuesday, 10 January 2023 at 00:17:18 UTC, Paul wrote:

>

I know. Someone's going to say why don't YOU do it:)

https://github.com/crazymonkyyy/dingbats

I could use contributors

January 10, 2023
On 10.01.23 01:17, Paul wrote:
There is also https://exercism.org/tracks/d with some tasks for dlang.

Kind regards,
Christian

January 10, 2023
On Tuesday, 10 January 2023 at 01:22:33 UTC, H. S. Teoh wrote:
...
>
> Here's a challenge.  Given an input year, for example, "2023", write a program that outputs (for the corresponding year):
>
...
>
> Code will be graded on readability, unittest coverage, and reusability (how many functions have wide applicability outside of this challenge).
>
> ;-)
>
>
> T

I think you must have done a blog post or tutorial or something, Teoh, because I've seen this before.  Don't let this go to your head :), but I was blown away by the presentation and solution!  BTW where is it posted?

January 10, 2023
On Tuesday, 10 January 2023 at 22:10:57 UTC, Paul wrote:
> ...
> I think you must have done a blog post or tutorial or something, Teoh, because I've seen this before.  Don't let this go to your head :), but I was blown away by the presentation and solution!  BTW where is it posted?

ITT: https://forum.dlang.org/post/tpjhr3$2ilc$1@digitalmars.com

drug007 wrote:

>[To clarify the situation](https://wiki.dlang.org/Component_programming_with_ranges)
>(H S Teoh is the author of this article)

Matheus.
January 10, 2023
On Tuesday, 10 January 2023 at 19:10:09 UTC, Christian Köstlin wrote:
> On 10.01.23 01:17, Paul wrote:
> There is also https://exercism.org/tracks/d with some tasks for dlang.
>
> Kind regards,
> Christian

Its all converted code; worthless