Re: D and math, can you isolate this ?

2016-09-20 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 12:35:18 UTC, Basile B. wrote: I've recently started an easing/interpolation family of function in my D user library. It's based on something I know well since I've already used them in 2012 in a VST plugin called GrainPlot (RIP). However for one of the

Re: What exactly does the compiler switch -betterC do?

2016-09-20 Thread Anonymouse via Digitalmars-d-learn
On Monday, 20 June 2016 at 06:35:32 UTC, Jacob Carlborg wrote: On 2016-06-19 21:53, Gary Willoughby wrote: When compiling, what exactly does the -betterC flag do? The command help says "omit generating some runtime information and helper functions" but what does this really mean? Is there any

Re: Append const to array

2016-09-20 Thread Yuxuan Shui via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 22:38:33 UTC, Jonathan M Davis wrote: On Tuesday, September 20, 2016 22:23:08 Yuxuan Shui via Digitalmars-d-learn wrote: struct A { ulong[] x; } struct B { ulong x; } void main() { B[] b; const(B) xx = B(1); b ~= xx; // Works A[] c; const(A) yy =

Re: Append const to array

2016-09-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 20, 2016 22:23:08 Yuxuan Shui via Digitalmars-d-learn wrote: > struct A { > ulong[] x; > } > struct B { > ulong x; > } > void main() { > B[] b; > const(B) xx = B(1); > b ~= xx; // Works > > A[] c; > const(A) yy = A([1]); > c ~= yy; // Does not > } > > What

Append const to array

2016-09-20 Thread Yuxuan Shui via Digitalmars-d-learn
struct A { ulong[] x; } struct B { ulong x; } void main() { B[] b; const(B) xx = B(1); b ~= xx; // Works A[] c; const(A) yy = A([1]); c ~= yy; // Does not } What gives?

Re: Using Libraries

2016-09-20 Thread Karabuta via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 15:38:55 UTC, Darren wrote: On Tuesday, 20 September 2016 at 15:07:53 UTC, rikki cattermole wrote: Ok lets start at the very beginning... I think I need to start before that, haha. I might need more of a step-by-step guide. I'm a complete beginner to

setting fields of object using traits

2016-09-20 Thread Ram_B via Digitalmars-d-learn
I'm trying to set fields of object from JSON with traits library. How i can to it properly? import std.stdio; import std.json; import std.traits; import std.meta: Alias; class Obj{ void fromJSON(this T)(JSONValue j){ foreach(field; FieldNameTuple!T){

Re: thisExePath purity

2016-09-20 Thread crimaniak via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 13:35:27 UTC, Steven Schveighoffer wrote: Yes, but if your code does instantiate it, it is called, even if you don't ever call the function that calls it. Yes, it's not ideal but better then just global variable and static block - it's called in any case, even

Re: thisExePath purity

2016-09-20 Thread crimaniak via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 09:14:39 UTC, Marc Schütz wrote: Have a look at `std.concurrency.initOnce`: https://dlang.org/phobos/std_concurrency.html#.initOnce But you will still need to use assumePure() for calling `thisExePath`, and it might do other things that are impure... Yes,

Re: thisExePath purity

2016-09-20 Thread crimaniak via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 04:26:05 UTC, Jonathan M Davis wrote: On Tuesday, September 20, 2016 04:17:21 crimaniak via Digitalmars-d-learn wrote: static shared immutable ReturnType!T value; I would point out that immutable is implicitly shared, so there's no reason to put

Re: D and math, can you isolate this ?

2016-09-20 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Sep 20, 2016 at 09:22:19AM -0700, H. S. Teoh via Digitalmars-d-learn wrote: > On Tue, Sep 20, 2016 at 12:35:18PM +, Basile B. via Digitalmars-d-learn > wrote: > [...] [...] > > Which means that I ask you if you can isolate c for > > > > y = 1.0 - pow(1.0 - pow(0.5, 2.0/c), c * 0.5);

Re: D and math, can you isolate this ?

2016-09-20 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 16:22:19 UTC, H. S. Teoh wrote: On Tue, Sep 20, 2016 at 12:35:18PM +, Basile B. via Digitalmars-d-learn wrote: [...] The problem is here: https://github.com/BBasile/iz/blob/master/import/iz/math.d#L849 - f(x,c) = 1.0 - pow(1.0 - pow(x, 2.0/c), c * 0.5); -

Re: D and math, can you isolate this ?

2016-09-20 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Sep 20, 2016 at 12:35:18PM +, Basile B. via Digitalmars-d-learn wrote: [...] > The problem is here: > https://github.com/BBasile/iz/blob/master/import/iz/math.d#L849 > - f(x,c) = 1.0 - pow(1.0 - pow(x, 2.0/c), c * 0.5); > - c(f0.5)) = ? > > Which means that I ask you if you can

Re: Using Libraries

2016-09-20 Thread Darren via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 15:07:53 UTC, rikki cattermole wrote: Ok lets start at the very beginning... I think I need to start before that, haha. I might need more of a step-by-step guide. I'm a complete beginner to programming, not just D. I worked through Programming in D,

Re: Using Libraries

2016-09-20 Thread rikki cattermole via Digitalmars-d-learn
On 21/09/2016 3:01 AM, Darren wrote: Hey, all I keep hitting roadblocks and that's mainly due to not knowing how to include libraries. So far I've been getting by with downloading .dll's and including the necessary dependencies in the dub.json file and having that build/run my project. I'm

Using Libraries

2016-09-20 Thread Darren via Digitalmars-d-learn
Hey, all I keep hitting roadblocks and that's mainly due to not knowing how to include libraries. So far I've been getting by with downloading .dll's and including the necessary dependencies in the dub.json file and having that build/run my project. I'm sure I'm making a mess of that, too,

Re: D and math, can you isolate this ?

2016-09-20 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 12:35:18 UTC, Basile B. wrote: I've recently started an easing/interpolation family of function in my D user library. It's based on something I know well since I've already used them in 2012 in a VST plugin called GrainPlot (RIP). However for one of the

Re: thisExePath purity

2016-09-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/20/16 12:17 AM, crimaniak wrote: Hi and thanks all! On Tuesday, 20 September 2016 at 00:43:10 UTC, Jonathan M Davis wrote: immutable string executablePath; shared static this() { import std.file : thisExePath(); executablePath = thisExePath(); } This code is good for my needs

D and math, can you isolate this ?

2016-09-20 Thread Basile B. via Digitalmars-d-learn
I've recently started an easing/interpolation family of function in my D user library. It's based on something I know well since I've already used them in 2012 in a VST plugin called GrainPlot (RIP). However for one of the function, I can't manage to get the inverse. A function that's

Re: thisExePath purity

2016-09-20 Thread Marc Schütz via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 04:17:21 UTC, crimaniak wrote: Hi and thanks all! On Tuesday, 20 September 2016 at 00:43:10 UTC, Jonathan M Davis wrote: immutable string executablePath; shared static this() { import std.file : thisExePath(); executablePath = thisExePath(); }

Re: What blogs about D do you read?

2016-09-20 Thread sarn via Digitalmars-d-learn
Don't forget the Planet D aggregator :) http://planet.dsource.org/ Here's my contribution: https://theartofmachinery.com/tags/dlang/

Re: What blogs about D do you read?

2016-09-20 Thread Saurabh Das via Digitalmars-d-learn
On Monday, 19 September 2016 at 19:36:22 UTC, Karabuta wrote: On Monday, 19 September 2016 at 19:29:25 UTC, A D dev wrote: On Monday, 19 September 2016 at 17:42:51 UTC, A D dev wrote: Hi list, What blogs about D do you read? To be more clear: - what blogs that include posts on D, would you