Re: enum functions

2023-01-09 Thread Salih Dincer via Digitalmars-d-learn
On Sunday, 8 January 2023 at 18:42:58 UTC, Salih Dincer wrote: I'm wondering 2 things; firstly, does having an enum mean there is no auto-return? Or could it be CTFE? Second, why is there no inference when I use an enum in one of the functions below? I'm still wondering 😀 SDB@79

Re: Coding Challenges - Dlang or Generic

2023-01-09 Thread Salih Dincer via Digitalmars-d-learn
On Tuesday, 10 January 2023 at 03:18:54 UTC, matheus wrote: The layout isn't like yours, I wrote this using a D Online compiler and I'm very sleepy right now: ```d import std.stdio, std.string, std.conv, std.datetime; bool validDate(int y,int m,int d){ try{ Date(y,m,d); retur

Re: Coding Challenges - Dlang or Generic

2023-01-09 Thread thebluepandabear via Digitalmars-d-learn
I know. Someone's going to say why don't YOU do it:) regards, The official book on D by Ali has many coding challenges. There isn't any need to create a website for D coding challenges or incorporate it into an existing website since D has under 1% of the market share.

Re: Coding Challenges - Dlang or Generic

2023-01-09 Thread Siarhei Siamashka via Digitalmars-d-learn
On Tuesday, 10 January 2023 at 00:17:18 UTC, Paul wrote: I was wondering if anyone knew of any coding challenges available where the input and output are specified and its left to the programmer to find a solution? Free would be nice but even paid services would be worth considering. I'm taki

Re: Coding Challenges - Dlang or Generic

2023-01-09 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jan 10, 2023 at 03:18:54AM +, matheus via Digitalmars-d-learn wrote: > 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): > > ... >

Re: Coding Challenges - Dlang or Generic

2023-01-09 Thread matheus via Digitalmars-d-learn
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): ... The layout isn't like yours, I wrote this using a D Online compiler and I'm very sleepy right now:

Re: Coding Challenges - Dlang or Generic

2023-01-09 Thread Ali Çehreli via Digitalmars-d-learn
On 1/9/23 16:17, Paul wrote: > coding challenges Perhaps the following two? https://rosettacode.org/ https://adventofcode.com/ Ali

Re: Coding Challenges - Dlang or Generic

2023-01-09 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jan 10, 2023 at 12:17:18AM +, Paul via Digitalmars-d-learn wrote: > Greetings Dlang-ers > I was wondering if anyone knew of any coding challenges available > where the input and output are specified and its left to the > programmer to find a solution? Here's a challenge. Given an inpu

Coding Challenges - Dlang or Generic

2023-01-09 Thread Paul via Digitalmars-d-learn
Greetings Dlang-ers I was wondering if anyone knew of any coding challenges available where the input and output are specified and its left to the programmer to find a solution? Free would be nice but even paid services would be worth considering. I'm taking a D class right now and it has li

Re: what wrong with this alias

2023-01-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/8/23 12:42 AM, Qusatlegadus wrote:     auto s = 1234.to!string.map!q{a - '0'}.sum; works fine. but if i do an alias     alias comb = to!string.map!q{a - '0'}     Error: unknown, please file report on issues.dlang.org What's wrong with this alias? Aside from the problem with the cod

Re: How to avoid variable capturing in `foreach` loop with lambdas?

2023-01-09 Thread bauss via Digitalmars-d-learn
On Monday, 9 January 2023 at 00:19:39 UTC, thebluepandabear wrote: Fixing this will improve the quality of the language for newcomers such as myself greatly. This not only confuses newcomers but it gave a false illusion of a bug within the code :/ It doesn't confuse newcomers only, also peop