digitalmars.D.learn - Are there any exercises/challenges for D?
- maik klein (3/3) Aug 24 2014 Are there any exercises/challenges for D?
- bearophile (7/10) Aug 24 2014 This is an interesting question. There are many
- Weaseldog (3/6) Aug 24 2014 Well, you could port 99 lisp problems to D - D can be written in
- maik klein (6/13) Aug 24 2014 I am just trying to learn D by writing code. Of course I could
- "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= (2/4) Aug 24 2014 Bearophile has created many such examples at Rosettacode.
- Ola Fosheim Gr (4/8) Aug 24 2014 http://rosettacode.org/wiki/Category:D
- bearophile (5/6) Aug 24 2014 I am updating and improving them, but I have created only a
- Meta (19/33) Aug 25 2014 Have you heard of Project Euler? https://projecteuler.net/
- Meta (14/32) Aug 25 2014 Whoops, wrong code. Also, this is the answer to PE problem 2.
- bearophile (6/7) Aug 26 2014 Some exercises here:
Are there any exercises/challenges for D? Something like this? http://www.haskell.org/haskellwiki/99_questions/1_to_10
Aug 24 2014
maik klein:Are there any exercises/challenges for D? Something like this? http://www.haskell.org/haskellwiki/99_questions/1_to_10This is an interesting question. There are many exercises/challenges that can be done in D, but I don't know any specific for D. As D challenge I suggest to write a useful Phobos pull request, there are many many missing useful functions. Bye, bearophile
Aug 24 2014
On Sunday, 24 August 2014 at 20:32:02 UTC, maik klein wrote:Are there any exercises/challenges for D? Something like this? http://www.haskell.org/haskellwiki/99_questions/1_to_10Well, you could port 99 lisp problems to D - D can be written in a fairly functional style ;)
Aug 24 2014
On Sunday, 24 August 2014 at 21:51:39 UTC, Weaseldog wrote:On Sunday, 24 August 2014 at 20:32:02 UTC, maik klein wrote:I am just trying to learn D by writing code. Of course I could just do them in D but I would like to compare my version with idiomatic D. It's actually quite strange that no one has done something like this in D, it's usually the first thing people do.Are there any exercises/challenges for D? Something like this? http://www.haskell.org/haskellwiki/99_questions/1_to_10Well, you could port 99 lisp problems to D - D can be written in a fairly functional style ;)
Aug 24 2014
On Sunday, 24 August 2014 at 23:20:21 UTC, maik klein wrote:It's actually quite strange that no one has done something like this in D, it's usually the first thing people do.Bearophile has created many such examples at Rosettacode.
Aug 24 2014
On Sunday, 24 August 2014 at 23:36:55 UTC, Ola Fosheim Grøstad wrote:On Sunday, 24 August 2014 at 23:20:21 UTC, maik klein wrote:http://rosettacode.org/wiki/Category:D Pretty long list of tasks?It's actually quite strange that no one has done something like this in D, it's usually the first thing people do.Bearophile has created many such examples at Rosettacode.
Aug 24 2014
Ola Fosheim Grøstad:Bearophile has created many such examples at Rosettacode.I am updating and improving them, but I have created only a percentage of them (60-70%? I don't know). Bye, bearophile
Aug 24 2014
On Sunday, 24 August 2014 at 23:20:21 UTC, maik klein wrote:On Sunday, 24 August 2014 at 21:51:39 UTC, Weaseldog wrote:Have you heard of Project Euler? https://projecteuler.net/ The problems are mostly mathematical, and once you answer you can compare your solution to the other solutions people have written in other languages. The early questions also have some very unique and beautiful range-based D solutions. import std.algorithm; import std.range; import std.stdio; alias fold = std.functional.binaryReverseArgs!(reduce!((n1, n2) => n1 + n2)); enum limit = 4_000_000; void main() { recurrence!q{a[n-1] + a[n-2]}(1, 1) .take(1000) .filter!(n => n >= 0 && n < limit && n % 2 == 0) .sum.writeln; }On Sunday, 24 August 2014 at 20:32:02 UTC, maik klein wrote:I am just trying to learn D by writing code. Of course I could just do them in D but I would like to compare my version with idiomatic D. It's actually quite strange that no one has done something like this in D, it's usually the first thing people do.Are there any exercises/challenges for D? Something like this? http://www.haskell.org/haskellwiki/99_questions/1_to_10Well, you could port 99 lisp problems to D - D can be written in a fairly functional style ;)
Aug 25 2014
On Tuesday, 26 August 2014 at 01:57:06 UTC, Meta wrote:Have you heard of Project Euler? https://projecteuler.net/ The problems are mostly mathematical, and once you answer you can compare your solution to the other solutions people have written in other languages. The early questions also have some very unique and beautiful range-based D solutions. import std.algorithm; import std.range; import std.stdio; alias fold = std.functional.binaryReverseArgs!(reduce!((n1, n2) => n1 + n2)); enum limit = 4_000_000; void main() { recurrence!q{a[n-1] + a[n-2]}(1, 1) .take(1000) .filter!(n => n >= 0 && n < limit && n % 2 == 0) .sum.writeln; }Whoops, wrong code. Also, this is the answer to PE problem 2. import std.algorithm; import std.range; import std.stdio; enum limit = 4_000_000; void main() { recurrence!q{a[n-1] + a[n-2]}(1, 1) .take(1000) .filter!(n => n >= 0 && n < limit && n % 2 == 0) .sum .writeln; }
Aug 25 2014
maik klein:Are there any exercises/challenges for D?Some exercises here: http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_D Please announce them here when you solve some of them :-) Bye, bearophile
Aug 26 2014