Scss file with vibe.d

2020-03-12 Thread GreatSam4sure via Digitalmars-d-learn
I want to ask if vibe.d support scss files. I could not get vibe.d to work with scss files. As usual, I will appreciate any help and early reply

Re: 2d graphic and multimedia

2020-03-12 Thread drug via Digitalmars-d-learn
On 3/12/20 7:33 AM, Noor Wachid wrote: I usually go with SFML (C++) library to write simple visualization. Is there any similiar library in D? https://code.dlang.org/packages/dsfml

A set type implemented as an AA wrapper

2020-03-12 Thread mark via Digitalmars-d-learn
I use sets a lot and since I believe that D's rbtree is O(lg n) for add/remove/in and that D's AA is O(1) for these, I want to implement a set in terms of an AA. Below is the code I've got so far. It allows for add and remove. However, it has three problems (that I know of): XXX: I need to u

Re: A set type implemented as an AA wrapper

2020-03-12 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 12 March 2020 at 08:51:24 UTC, mark wrote: I use sets a lot and since I believe that D's rbtree is O(lg n) for add/remove/in and that D's AA is O(1) for these, I want to implement a set in terms of an AA. XXX: I need to use an if on the struct to restrict T to be a type that supp

Re: A set type implemented as an AA wrapper

2020-03-12 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 12 March 2020 at 08:51:24 UTC, mark wrote: I use sets a lot and since I believe that D's rbtree is O(lg n) for add/remove/in and that D's AA is O(1) for these, I want to implement a set in terms of an AA. Below is the code I've got so far. It allows for add and remove. However, i

Re: A set type implemented as an AA wrapper

2020-03-12 Thread mark via Digitalmars-d-learn
On Thursday, 12 March 2020 at 11:33:25 UTC, Simen Kjærås wrote: [snip] I'd suggest simply testing if an AA with that key type is valid: struct AAset(T) if (is(int[T])) That's very subtle, but it works. As Ferhat points out, you could use opApply for this. There's also the option of imple

Re: A set type implemented as an AA wrapper

2020-03-12 Thread mark via Digitalmars-d-learn
Just in case anyone would like to use it, I've put it on github and also added it as a dub package. https://code.dlang.org/packages/aaset

Re: A set type implemented as an AA wrapper

2020-03-12 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Mar 12, 2020 at 08:51:24AM +, mark via Digitalmars-d-learn wrote: [...] > YYY: The range() method is clearly not good D style but I don't know > how to support foreach (item; aaset) ... The usual idiom is to overload .opSlice, then you can do: foreach (item; aaset[]) { ... }

Re: 2d graphic and multimedia

2020-03-12 Thread Murilo via Digitalmars-d-learn
On Thursday, 12 March 2020 at 04:33:42 UTC, Noor Wachid wrote: I usually go with SFML (C++) library to write simple visualization. Is there any similiar library in D? I use the arsd library for everything. It allows multimedia and much more, it's light, fast, small and very easy to use since i

Re: A set type implemented as an AA wrapper

2020-03-12 Thread mark via Digitalmars-d-learn
On Thursday, 12 March 2020 at 16:02:14 UTC, H. S. Teoh wrote: On Thu, Mar 12, 2020 at 08:51:24AM +, mark via Digitalmars-d-learn wrote: [...] YYY: The range() method is clearly not good D style but I don't know how to support foreach (item; aaset) ... The usual idiom is to overload .opSli

Associative Array potential performance pitfall?

2020-03-12 Thread Adnan via Digitalmars-d-learn
In my machine the following D code compiled with release flag and LDC performs over 230ms while the similar Go code performs under 120ms. string smallestRepr(const string arg) { import std.format : format; const repeated = format!"%s%s"(arg, arg); string result;

How can I append PATH to environment["PATH"] in runtime?

2020-03-12 Thread Marcone via Digitalmars-d-learn
environment["PATH"] ~= r";D:\folder\"; // Error