Re: For fun: Expressive C++ 17 Coding Challenge in D

2017-10-15 Thread Christian Köstlin via Digitalmars-d-learn
Another solution using dlangs builtin csv support for reading. import std.csv; import std.file; import std.algorithm : map; import std.range; string csvWrite(Header, Rows)(Header header, Rows rows) { return header.join(",") ~ "\n" ~ rows.map!(r => header.map!(h =>

Re: For fun: Expressive C++ 17 Coding Challenge in D

2017-10-06 Thread kerdemdemir via Digitalmars-d-learn
I am a total beginner but I want to post that a lot. auto autoCorrelation(R)(R range) if (isRandomAccessRange!R) { import std.numeric : fft, inverseFft; import std.range : chain, repeat, zip, dropBack; import std.algorithm : map; import std.complex;

Re: For fun: Expressive C++ 17 Coding Challenge in D

2017-10-05 Thread Biotronic via Digitalmars-d-learn
On Wednesday, 4 October 2017 at 19:20:12 UTC, Jesse Phillips wrote: On Wednesday, 4 October 2017 at 15:26:02 UTC, Ali Çehreli wrote: On 10/04/2017 02:04 AM, Biotronic wrote: ... Hey where is the list of features used e.g: ranges, ufcs... Features used: D. But sure, added them to the gist:

Re: For fun: Expressive C++ 17 Coding Challenge in D

2017-10-04 Thread lithium iodate via Digitalmars-d-learn
On Wednesday, 4 October 2017 at 15:30:08 UTC, Ali Çehreli wrote: the hidden \r characters at the ends Those got me too! Here's my less than optimal solution: int main(string[] args) { import std.stdio; import std.algorithm.iteration : map, splitter, joiner, each; import

Re: For fun: Expressive C++ 17 Coding Challenge in D

2017-10-04 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 4 October 2017 at 15:26:02 UTC, Ali Çehreli wrote: On 10/04/2017 02:04 AM, Biotronic wrote: ... Hey where is the list of features used e.g: ranges, ufcs...

Re: For fun: Expressive C++ 17 Coding Challenge in D

2017-10-04 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 4 October 2017 at 15:30:08 UTC, Ali Çehreli wrote: On 10/04/2017 02:26 AM, Atila Neves wrote: > in D so trivial it'd probably make me sleep out of boredom. I spent more time on this obviously trivial program than necessary. :( In addition to facing known template resolution

Re: For fun: Expressive C++ 17 Coding Challenge in D

2017-10-04 Thread Ali Çehreli via Digitalmars-d-learn
On 10/04/2017 02:26 AM, Atila Neves wrote: > in D so trivial it'd probably make me sleep out of boredom. I spent more time on this obviously trivial program than necessary. :( In addition to facing known template resolution issues, the hidden \r characters at the ends of some of the fields in

Re: For fun: Expressive C++ 17 Coding Challenge in D

2017-10-04 Thread Ali Çehreli via Digitalmars-d-learn
On 10/04/2017 02:04 AM, Biotronic wrote: > I opted for writing to stdout instead, because 1) it's easier, x) it's > less code, and b) it's more flexible. Exactly! :) > a simple replacement of readText with an mmapped equivalent should > enable humongous file support with no other code change

Re: For fun: Expressive C++ 17 Coding Challenge in D

2017-10-04 Thread Biotronic via Digitalmars-d-learn
On Wednesday, 4 October 2017 at 09:04:58 UTC, Biotronic wrote: Since the code uses ranges though, a simple replacement of readText with an mmapped equivalent should enable humongous file support with no other code change required. Drop-in replacement for readText: struct MmText { import

Re: For fun: Expressive C++ 17 Coding Challenge in D

2017-10-04 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 19:25:56 UTC, Ali Çehreli wrote: Found on Reddit: https://www.reddit.com/r/programming/comments/740617/the_expressive_c17_coding_challenge/ How would you do it in D? Ali P.S. You can ignore the following note from the challenge text; I don't think it applies

Re: For fun: Expressive C++ 17 Coding Challenge in D

2017-10-04 Thread Biotronic via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 19:25:56 UTC, Ali Çehreli wrote: Found on Reddit: https://www.reddit.com/r/programming/comments/740617/the_expressive_c17_coding_challenge/ How would you do it in D? Ali P.S. You can ignore the following note from the challenge text; I don't think it applies

For fun: Expressive C++ 17 Coding Challenge in D

2017-10-03 Thread Ali Çehreli via Digitalmars-d-learn
Found on Reddit: https://www.reddit.com/r/programming/comments/740617/the_expressive_c17_coding_challenge/ How would you do it in D? Ali P.S. You can ignore the following note from the challenge text; I don't think it applies to D. Honestly, I don't think it matters for C++17 either. :)