Creates a Task on the GC heap that calls an alias.
If possible, there's also scopedTask, which allocates on the stack:
https://dlang.org/phobos/std_parallelism.html#.scopedTask
So my question is: Has anyone done any analysis over how "dangerous" it is to use GC'd tasks for
_small_ tasks (in
On 2020-01-15 16:34, mark via Digitalmars-d-learn wrote:
Is this as compact as it _reasonably_ can be?
How about this?
auto uniqueWords(string filename, uint wordsize) {
import std.algorithm, std.array, std.conv, std.functional, std.uni;
return File(filename).byLine
.map!(line
On 2020-01-16 04:54, Jesse Phillips via Digitalmars-d-learn wrote:
[...]
.map!(word => word.to!string.toUpper)
.array
.sort
.uniq
.map!(x => tuple (x, 0))
.assocArray ;
.each!(word => words[word.to!string.toUpper] = 0);
isn't far off, but could also be (sans imports):
return File(filename).b
From one noob to another: Not much of a difference, but levenshteinDistance seems to be a good fit
here. About as fast as your solution, slightly lower memory usage. byCodeUnit/byChar might shave off
a few more ms.
For small scripts like these I'm usually not even bothering with const correctne
On 2020-01-31 09:44, mark via Digitalmars-d-learn wrote:
I can't use the levenshtien distance because although it is a better solution,
[...]
Nah, it isn't, sorry for the noise, should have slept before sending the message, was thinking of
hamming distance:
auto a = "abcd";
auto b = "bcda";
On 2020-03-15 18:58, Steven Schveighoffer via Digitalmars-d-learn wrote:
I'd prefer to do it with D.
How about raylib in conjunction with thin d bindings? I prefer it over sdl,
sfml and the like.
https://www.raylib.com/examples.html (make sure to enable js for embedded
examples)
https://code
Hi there,
the task is simple: count word occurrences from stdin (around 150mb in
this case) and print sorted results to stdout in a somewhat idiomatic
fashion.
Now, d is quite elegant while maintaining high performance compared to
both c and c++, but I, as a complete beginner, can't identify
Assoc array allocations?
Yup. AAs do keep their memory around (supposedly for reuse). [...]
Why it consumes so much is a question to the implementation.
[...] I guess built-in AAs just love to hoard.
What a darn shame. This way I'm missing out on all those slick internet
benchmark points. :
On 3/3/19 7:07 PM, Samir via Digitalmars-d-learn wrote:
I am belatedly working my way through the 2018 edition of the Advent of
Code[1] programming challenges using D and am stumped on Problem 3[2].
The challenge requires you to parse a set of lines in the format:
#99 @ 652,39: 24x23
#100 @ 61
On 7/5/19 9:56 PM, ag0aep6g via Digitalmars-d-learn wrote:
On 05.07.19 20:49, Samir wrote:
As a follow-on to my earlier question, is there a way to pass a
variable to the `map` function that specifies the column, rather than
hard-coding it? I'm thinking of something like:
p.map!("a[column]")
On 7/5/19 9:56 PM, ag0aep6g via Digitalmars-d-learn wrote:
On 05.07.19 20:49, Samir wrote:
As a follow-on to my earlier question, is there a way to pass a
variable to the `map` function that specifies the column, rather than
hard-coding it? I'm thinking of something like:
p.map!("a[column]")
11 matches
Mail list logo