Re: Zip vs Enumerate

2018-06-19 Thread Dukc via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 03:44:58 UTC, Jordan Wilson wrote: Is there anything I can do to improve zip, before I go ahead and change to the faster but slightly less readable enumerate? The problem might be that zip checks both arrays for empty during each step, enumerate only the first one

Re: Zip vs Enumerate

2018-06-19 Thread Cym13 via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 04:40:42 UTC, Cym13 wrote: On Wednesday, 20 June 2018 at 03:44:58 UTC, Jordan Wilson wrote: [...] This sounds like a very limited case: if you're not zipping against a iota(foo) then there's no comparing with enumerate, they simply don't do the same thing at all

Re: Zip vs Enumerate

2018-06-19 Thread Cym13 via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 03:44:58 UTC, Jordan Wilson wrote: Hello, Idiomatically, I make use of zip, however, when looking to speed up my program, notice that using enumerate leads to a 20-30% improvement: void main(){ auto x = iota(1_000).array; auto y = iota(1_000).array;

Zip vs Enumerate

2018-06-19 Thread Jordan Wilson via Digitalmars-d-learn
Hello, Idiomatically, I make use of zip, however, when looking to speed up my program, notice that using enumerate leads to a 20-30% improvement: void main(){ auto x = iota(1_000).array; auto y = iota(1_000).array; auto func1() { return zip(x,y).map!(a => a[0]+a[1])

Re: I can share non shared things?

2018-06-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/19/18 4:09 PM, gdelazzari wrote: So, let's say I have this code https://run.dlang.io/is/CaMJjd It doesn't compile, and that makes sense since myNotSharedObject is... not shared. So I can fix it by making the class shared and making a shared instance of it, like this https://run.dlang.i

I can share non shared things?

2018-06-19 Thread gdelazzari via Digitalmars-d-learn
So, let's say I have this code https://run.dlang.io/is/CaMJjd It doesn't compile, and that makes sense since myNotSharedObject is... not shared. So I can fix it by making the class shared and making a shared instance of it, like this https://run.dlang.io/is/hoMFD1 And that's how shared is s

Re: What is the point of nothrow?

2018-06-19 Thread wjoe via Digitalmars-d-learn
On Tuesday, 19 June 2018 at 12:26:15 UTC, Kagamin wrote: On Friday, 15 June 2018 at 17:46:02 UTC, wjoe wrote: D allows various levels of performance and safety. Though I'd say Errors not working in debug mode is not intended, the Intention matters not. By definition all program state is inval

Re: What is the point of nothrow?

2018-06-19 Thread Kagamin via Digitalmars-d-learn
On Friday, 15 June 2018 at 17:46:02 UTC, wjoe wrote: D allows various levels of performance and safety. Though I'd say Errors not working in debug mode is not intended, the Intention matters not. By definition all program state is invalid at the point an Error was thrown. From there on it is

Re: Orange check failling all of a sudden

2018-06-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-06-11 20:00, DigitalDesigns wrote: Changed some things in my app but unrelated to serialization and now my app fails when trying to read the xml that was generated at the output of the previous run. Where it is failing is here: void checkSpace(ref string s) @safe pure // rule 3

Re: Orange check failling all of a sudden

2018-06-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-06-12 02:13, DigitalDesigns wrote: I also get a lot of inout's attached to key names. Seems excessive but inout(inout(double)[]) Maybe they are necessary but seems like they are redundant. I don't think they're technically necessary. -- /Jacob Carlborg

Re: Get static fields!

2018-06-19 Thread Simen Kjærås via Digitalmars-d-learn
On Saturday, 16 June 2018 at 05:05:19 UTC, DigitalDesigns wrote: tupleof does not return static fields as does not Fields. Currently the only method seems to be use allMembers, but that returns members requiring filtering, which there is no good filtering checks. I'd simply like to get all the

Re: Orange check failling all of a sudden

2018-06-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-06-13 02:31, DigitalDesigns wrote: Also, is there any way to have a field as optional? Right now when I update a filed in a serialized type the app crashes because it can't find the field in the serialized data(since it was just added in the code). This requires either regenerating the da

Re: Create a List or Dictionary.

2018-06-19 Thread ag0aep6g via Digitalmars-d-learn
On 06/19/2018 11:50 AM, Sunny wrote: I read about D here - https://www.tutorialspoint.com/d_programming/index.htm I'd advise against using that tutorial. Last time I looked at it, it seemed to be of low quality [1]. And the better parts seemed to be stolen from Ali Çehreli's "Programming in D

Re: What is the point of nothrow?

2018-06-19 Thread wjoe via Digitalmars-d-learn
On Monday, 18 June 2018 at 20:23:48 UTC, Jonathan M Davis wrote: On Monday, June 18, 2018 15:22:48 wjoe via Digitalmars-d-learn wrote: On Saturday, 16 June 2018 at 21:25:01 UTC, Jonathan M Davis wrote: > every feature that you can't use in betterC is considered a > loss, and efforts are being m

Re: Create a List or Dictionary.

2018-06-19 Thread Sunny via Digitalmars-d-learn
On Tuesday, 19 June 2018 at 09:07:46 UTC, Cym13 wrote: On Tuesday, 19 June 2018 at 05:52:00 UTC, Sunny wrote: On Monday, 18 June 2018 at 13:23:37 UTC, Cym13 wrote: Yes, this is what need, thank you very much for your help. :-) [...] I recommend that you take the D tour if you can, it explai

Re: Create a List or Dictionary.

2018-06-19 Thread Cym13 via Digitalmars-d-learn
On Tuesday, 19 June 2018 at 05:52:00 UTC, Sunny wrote: On Monday, 18 June 2018 at 13:23:37 UTC, Cym13 wrote: Yes, this is what need, thank you very much for your help. :-) [...] I recommend that you take the D tour if you can, it explains all those fundamental features quite well I think.