D is for Data Science

2014-11-24 Thread Gary Willoughby via Digitalmars-d-announce
Just browsing reddit and found this article posted about D. Written by Andrew Pascoe of AdRoll. From the article: The D programming language has quickly become our language of choice on the Data Science team for any task that requires efficiency, and is now the keystone language for our

dfix 0.2.0

2014-11-24 Thread Brian Schott via Digitalmars-d-announce
dfix is a tool for automatically upgrading the syntax of D source code. Changes since 0.1.1: * #1 dfix will now rewrite const int foo() {} to int foo() const {} * #6 The C-style array syntax fix is no longer incorrectly applied to certain ASM statements. * #9 You can now provide directory

D is for Data Science - reddit discussion

2014-11-24 Thread MrSmith via Digitalmars-d-announce
D is for Data Science by Andrew Pascoe http://www.reddit.com/r/programming/comments/2n9gfb/d_is_for_data_science/

Re: D is for Data Science - reddit discussion

2014-11-24 Thread MrSmith via Digitalmars-d-announce
Haven't noticed that it was already posted. Sorry about that. The disscussion is here http://forum.dlang.org/thread/qeyftagcvkhjjeeba...@forum.dlang.org

Re: DerelictSASS

2014-11-24 Thread Colden Cullen via Digitalmars-d-announce
On Monday, 24 November 2014 at 17:32:36 UTC, Lodin wrote: Of course, I want to register it, but I think it should be a part of Derelict Project, not unofficial binding. What should I do to realize it? And one thing about the diet plugin. I plan to make thin wrapper around binding to simplify

Re: D is for Data Science

2014-11-24 Thread weaselcat via Digitalmars-d-announce
On Monday, 24 November 2014 at 15:27:19 UTC, Gary Willoughby wrote: Just browsing reddit and found this article posted about D. Written by Andrew Pascoe of AdRoll. From the article: The D programming language has quickly become our language of choice on the Data Science team for any task that

Re: D is for Data Science

2014-11-24 Thread Dmitry Olshansky via Digitalmars-d-announce
25-Nov-2014 00:34, weaselcat пишет: On Monday, 24 November 2014 at 15:27:19 UTC, Gary Willoughby wrote: Just browsing reddit and found this article posted about D. Written by Andrew Pascoe of AdRoll. From the article: The D programming language has quickly become our language of choice on the

Re: D is for Data Science

2014-11-24 Thread bearophile via Digitalmars-d-announce
Dmitry Olshansky: Why is File.byLine so slow? Seems to be mostly fixed sometime ago. Really? I am not so sure. Bye, bearophile

Re: D is for Data Science

2014-11-24 Thread Walter Bright via Digitalmars-d-announce
On 11/24/2014 2:25 PM, Dmitry Olshansky wrote: [...] Excellent comments. Please post them on the reddit page!

Re: D is for Data Science

2014-11-24 Thread Jay Norwood via Digitalmars-d-announce
On Monday, 24 November 2014 at 15:27:19 UTC, Gary Willoughby wrote: Just browsing reddit and found this article posted about D. Written by Andrew Pascoe of AdRoll. From the article: The D programming language has quickly become our language of choice on the Data Science team for any task that

Re: D is for Data Science

2014-11-24 Thread Jay Norwood via Digitalmars-d-announce
On Monday, 24 November 2014 at 23:32:14 UTC, Jay Norwood wrote: Is this related? https://github.com/dscience-developers/dscience This seems good too. Why the comments in the discussion about lack of libraries? https://github.com/kyllingstad/scid/wiki

Re: D is for Data Science

2014-11-24 Thread Dmitry Olshansky via Digitalmars-d-announce
25-Nov-2014 01:28, bearophile пишет: Dmitry Olshansky: Why is File.byLine so slow? Seems to be mostly fixed sometime ago. Really? I am not so sure. Bye, bearophile I too has suspected it in the past and then I tested it. Now I test it again, it's always easier to check then to argue.

Re: D is for Data Science

2014-11-24 Thread bearophile via Digitalmars-d-announce
Dmitry Olshansky: Which is 1:1 parity. Another myth busted? ;) There is still an open bug report: https://issues.dlang.org/show_bug.cgi?id=11810 Do you want also to benchmark that byLineFast that for me is usually significantly faster than the byLine? Bye, bearophile

Re: D is for Data Science

2014-11-24 Thread Dmitry Olshansky via Digitalmars-d-announce
25-Nov-2014 02:43, bearophile пишет: Dmitry Olshansky: Which is 1:1 parity. Another myth busted? ;) dmitry@Ubu64 ~ $ time ./my2 log real0m0.065s user0m0.042s sys0m0.023s dmitry@Ubu64 ~ $ time ./my2 log real0m0.063s user0m0.040s sys0m0.023s Read the above

Re: D is for Data Science

2014-11-24 Thread Walter Bright via Digitalmars-d-announce
On 11/24/2014 7:27 AM, Gary Willoughby wrote: Just browsing reddit and found this article posted about D. https://www.reddit.com/r/programming/comments/2n9gfb/d_is_for_data_science/cmbn83i Thought I'd post this as a counterpoint to the recent please break our code thread.

Re: D is for Data Science

2014-11-24 Thread Adam D. Ruppe via Digitalmars-d-announce
On Tuesday, 25 November 2014 at 00:34:30 UTC, Walter Bright wrote: Thought I'd post this as a counterpoint to the recent please break our code thread. I would caution against putting very much weight in Reddit opinions - there's people who will never use D and just look for excuses to

Re: D is for Data Science

2014-11-24 Thread Walter Bright via Digitalmars-d-announce
On 11/24/2014 4:50 PM, Adam D. Ruppe wrote: On Tuesday, 25 November 2014 at 00:34:30 UTC, Walter Bright wrote: Thought I'd post this as a counterpoint to the recent please break our code thread. I would caution against putting very much weight in Reddit opinions - there's people who will

Re: D is for Data Science

2014-11-24 Thread weaselcat via Digitalmars-d-announce
With algorithm.sort the deciles bench from the article runs twice as fast(it's in the reddit thread) I see array.sort is planned for future deprecation, what does future fall under?

Re: Comparing Parallelization in HPC with D, Chapel, and Go

2014-11-24 Thread Ziad Hatahet via Digitalmars-d
On Sun, Nov 23, 2014 at 7:48 PM, Andrei Amatuni via Digitalmars-d digitalmars-d@puremagic.com wrote: not exactly the most rigorous research, but it's pretty favorable... Not even remotely rigorous. One has to wonder about the quality of the conference into which this paper was accepted.

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread Don via Digitalmars-d
On Friday, 21 November 2014 at 20:17:12 UTC, Walter Bright wrote: On 11/21/2014 7:36 AM, Don wrote: On Friday, 21 November 2014 at 04:53:38 UTC, Walter Bright wrote: 0 crossing bugs tend to show up much sooner, and often immediately. You're missing the point here. The problem is that people

Testing lazy ranges in post-conditions

2014-11-24 Thread bearophile via Digitalmars-d
If a function returns a lazy range, I can't verify its correctness in the function post-condition because inside the post-condition such range is const. An example of the problem: import std.range, std.algorithm; auto foo() out(result) { assert(result.all!(x = x 10)); } body {

Re: Comparing Parallelization in HPC with D, Chapel, and Go

2014-11-24 Thread Craig Dillabaugh via Digitalmars-d
On Monday, 24 November 2014 at 03:48:27 UTC, Andrei Amatuni wrote: This prompted me to google for recent academic papers on D, which led me to this: http://research.ijcaonline.org/volume104/number7/pxc3898921.pdf not exactly the most rigorous research, but it's pretty favorable... My main

Re: Testing lazy ranges in post-conditions

2014-11-24 Thread Peter Alexander via Digitalmars-d
Should be able to do: assert(result.save.all!(x = x 10)); But iota's save isn't const, so you can't (that's a bug).

Re: std.experimental.logger formal review round 3

2014-11-24 Thread Robert burner Schadek via Digitalmars-d
On Friday, 14 November 2014 at 23:06:22 UTC, Dicebot wrote: On Friday, 14 November 2014 at 22:20:17 UTC, Robert burner Schadek wrote: I will test something this weekend regarding the additional indirection. Thanks! I may try hacking some sample implementation too but pessimistic about ETA

Re: Testing lazy ranges in post-conditions

2014-11-24 Thread bearophile via Digitalmars-d
Peter Alexander: Should be able to do: assert(result.save.all!(x = x 10)); But iota's save isn't const, so you can't (that's a bug). Mine was just an example of the general problem, another example: import std.range, std.algorithm; auto foo() out(result) { assert(result.all!(b =

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread Don via Digitalmars-d
On Friday, 21 November 2014 at 17:23:51 UTC, Marco Leise wrote: Am Thu, 20 Nov 2014 08:18:23 + schrieb Don x...@nospam.com: It's particularly challenging in D because of the widespread use of 'auto': auto x = foo(); auto y = bar(); auto z = baz(); if (x - y z) { ... } This might be a

Re: Comparing Parallelization in HPC with D, Chapel, and Go

2014-11-24 Thread Russel Winder via Digitalmars-d
On Sun, 2014-11-23 at 13:09 -0800, Ziad Hatahet via Digitalmars-d wrote: On Sat, Nov 22, 2014 at 7:17 AM, Russel Winder via Digitalmars-d digitalmars-d@puremagic.com wrote: I have emailed the author. Keep us posted! Author replied. He is issuing source code on a bilateral

Re: Comparing Parallelization in HPC with D, Chapel, and Go

2014-11-24 Thread Russel Winder via Digitalmars-d
On Mon, 2014-11-24 at 11:53 +, Craig Dillabaugh via Digitalmars-d wrote: […] My main take away from that paper was that C is much slower than Java :o) This can happen! Based on those results it likely would have been trounced by Python or Ruby too. I don't know about Ruby, but Python

Re: Comparing Parallelization in HPC with D, Chapel, and Go

2014-11-24 Thread Nemanja Boric via Digitalmars-d
Compilers and interpreters used Turbo C++ IDE :-) On Monday, 24 November 2014 at 11:53:08 UTC, Craig Dillabaugh wrote: On Monday, 24 November 2014 at 03:48:27 UTC, Andrei Amatuni wrote: This prompted me to google for recent academic papers on D, which led me to this:

Re: Testing lazy ranges in post-conditions

2014-11-24 Thread Peter Alexander via Digitalmars-d
On Monday, 24 November 2014 at 12:20:40 UTC, bearophile wrote: Peter Alexander: Should be able to do: assert(result.save.all!(x = x 10)); But iota's save isn't const, so you can't (that's a bug). Mine was just an example of the general problem, another example: import std.range,

Re: Testing lazy ranges in post-conditions

2014-11-24 Thread bearophile via Digitalmars-d
Peter Alexander: Chunks.save should also be const, so result.save.{...} should work. But it doesn't. Should I have to file two bug reports (ERs) on iota and chunks? It becomes a real problem with input ranges, because you can't save them. That makes sense though, as there is no way to

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread Don via Digitalmars-d
On Friday, 21 November 2014 at 08:46:20 UTC, Walter Bright wrote: On 11/21/2014 12:10 AM, bearophile wrote: Walter Bright: All you're doing is trading 0 crossing for 0x7FFF crossing issues, and pretending the problems have gone away. I'm not pretending anything. I am asking in

Re: Testing lazy ranges in post-conditions

2014-11-24 Thread Peter Alexander via Digitalmars-d
On Monday, 24 November 2014 at 14:20:02 UTC, bearophile wrote: Peter Alexander: Chunks.save should also be const, so result.save.{...} should work. But it doesn't. Should I have to file two bug reports (ERs) on iota and chunks? I suppose chunks should be inout, because you might want

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread Andrei Alexandrescu via Digitalmars-d
On 11/24/14 2:20 AM, Don wrote: I am proposing that for .length returns a signed type, that for array slices is guaranteed to never be negative. Assuming you do make the case this change is an improvement, do you believe it's worth the breakage it would create? -- Andrei

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread Andrei Alexandrescu via Digitalmars-d
On 11/24/14 4:54 AM, Don wrote: In D, 1u - 2u 0u. This is defined behaviour, not an overflow. I think I get what you mean, but overflow is also defined behavior (in D at least). -- Andrei

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread ketmar via Digitalmars-d
On Mon, 24 Nov 2014 12:54:58 + Don via Digitalmars-d digitalmars-d@puremagic.com wrote: In D, 1u - 2u 0u. This is defined behaviour, not an overflow. p.s. sorry, of course this is not and overflow. this is underflow. signature.asc Description: PGP signature

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread ketmar via Digitalmars-d
On Mon, 24 Nov 2014 12:54:58 + Don via Digitalmars-d digitalmars-d@puremagic.com wrote: In D, 1u - 2u 0u. This is defined behaviour, not an overflow. this *is* overflow. D just has overflow result defined. signature.asc Description: PGP signature

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread via Digitalmars-d
On Monday, 24 November 2014 at 16:00:53 UTC, ketmar via Digitalmars-d wrote: this *is* overflow. D just has overflow result defined. So it basically is and isn't modular arithmetic at the same time? I think Ada got this right by providing the ability to specify the modulo value, so you can

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread Matthias Bentrup via Digitalmars-d
On Monday, 24 November 2014 at 16:45:35 UTC, Ola Fosheim Grøstad wrote: On Monday, 24 November 2014 at 16:00:53 UTC, ketmar via Digitalmars-d wrote: this *is* overflow. D just has overflow result defined. So it basically is and isn't modular arithmetic at the same time? Overflow is part of

Re: Comparing Parallelization in HPC with D, Chapel, and Go

2014-11-24 Thread ixid via Digitalmars-d
On Friday, 21 November 2014 at 22:57:44 UTC, Kapps wrote: On Friday, 21 November 2014 at 21:53:00 UTC, bearophile wrote: anon: https://www.academia.edu/3982638/A_Study_of_Successive_Over-relaxation_SOR_Method_Parallelization_Over_Modern_HPC_Languages Thank you for the link, it's very

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread via Digitalmars-d
On Monday, 24 November 2014 at 17:12:31 UTC, Matthias Bentrup wrote: Overflow is part of modular arithmetic. However, there is no signed and unsigned modular arithmetic, or, more precisely, they are the same. Would you say that a phase that goes from 0…2pi overflows? Does polar coordinates

Does RTTI and exceptions work in dlls on windows?

2014-11-24 Thread MrSmith via Digitalmars-d
I've got little test here https://gist.github.com/MrSmith33/8750dd43c0843d45ccf8#file-sharedmodule2-d-L17-L29. I have one application and two dlls. Application loads both dlls, calls their factory functions and then passes each IModule instance that it got from factories to those modules.

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread via Digitalmars-d
On Monday, 24 November 2014 at 17:55:06 UTC, Ola Fosheim Grøstad wrote: I think the point with having compiler support is to retain most optimizations. The compiler select the most efficient representation based on the needed headroom and makes sure that overflow is recorded so that you can

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread Matthias Bentrup via Digitalmars-d
On Monday, 24 November 2014 at 17:55:06 UTC, Ola Fosheim Grøstad wrote: On Monday, 24 November 2014 at 17:12:31 UTC, Matthias Bentrup wrote: Overflow is part of modular arithmetic. However, there is no signed and unsigned modular arithmetic, or, more precisely, they are the same. Would you

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread via Digitalmars-d
On Monday, 24 November 2014 at 19:06:35 UTC, Matthias Bentrup wrote: There is no right or wrong in Mathematics, only true and false. The result of modular addition with overflow is not wrong, it is just different than the result of integer addition. I think we are talking past each other. In

Re: Does RTTI and exceptions work in dlls on windows?

2014-11-24 Thread Rainer Schuetze via Digitalmars-d
On 24.11.2014 19:20, MrSmith wrote: I've got little test here https://gist.github.com/MrSmith33/8750dd43c0843d45ccf8#file-sharedmodule2-d-L17-L29. I have one application and two dlls. Application loads both dlls, calls their factory functions and then passes each IModule instance that it got

Re: Does RTTI and exceptions work in dlls on windows?

2014-11-24 Thread MrSmith via Digitalmars-d
On Monday, 24 November 2014 at 20:56:29 UTC, Rainer Schuetze wrote: On 24.11.2014 19:20, MrSmith wrote: I've got little test here https://gist.github.com/MrSmith33/8750dd43c0843d45ccf8#file-sharedmodule2-d-L17-L29. I have one application and two dlls. Application loads both dlls, calls

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread Walter Bright via Digitalmars-d
On 11/24/2014 2:20 AM, Don wrote: I believe I do understand the problem. As a practical matter, overflow checks are not going to be added for performance reasons. The performance overhead would be practically zero. All we would need to do, is restrict array slices such that the length cannot

Re: std.experimental.logger formal review round 3

2014-11-24 Thread Walter Bright via Digitalmars-d
Anyone know anything about this? https://www.reddit.com/r/programming/comments/2n9gfb/d_is_for_data_science/cmbssac

Re: Ranges and Exception handling PR 2724

2014-11-24 Thread Jonathan Marler via Digitalmars-d
On Friday, 21 November 2014 at 16:57:29 UTC, Marco Leise wrote: Am Fri, 21 Nov 2014 08:56:17 + schrieb Jonathan Marler johnnymar...@gmail.com: I actually ran into this problem today when using the dirEntries function in std.file. I was attempting to iterate all the files on my C drive

Re: Ranges and Exception handling PR 2724

2014-11-24 Thread Jonathan Marler via Digitalmars-d
On Tuesday, 25 November 2014 at 00:46:11 UTC, Jonathan Marler wrote: On Friday, 21 November 2014 at 16:57:29 UTC, Marco Leise wrote: Am Fri, 21 Nov 2014 08:56:17 + schrieb Jonathan Marler johnnymar...@gmail.com: I actually ran into this problem today when using the dirEntries function in

Re: std.experimental.logger formal review round 3

2014-11-24 Thread Brian Schott via Digitalmars-d
On Tuesday, 25 November 2014 at 00:37:00 UTC, Walter Bright wrote: Anyone know anything about this? https://www.reddit.com/r/programming/comments/2n9gfb/d_is_for_data_science/cmbssac You are posting to page 16 of the third iteration of a single review.

Re: std.experimental.logger formal review round 3

2014-11-24 Thread Walter Bright via Digitalmars-d
On 11/24/2014 4:51 PM, Brian Schott wrote: On Tuesday, 25 November 2014 at 00:37:00 UTC, Walter Bright wrote: Anyone know anything about this? https://www.reddit.com/r/programming/comments/2n9gfb/d_is_for_data_science/cmbssac You are posting to page 16 of the third iteration of a single

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread FrankLike via Digitalmars-d
On Monday, 24 November 2014 at 19:06:35 UTC, Matthias Bentrup wrote: Agreed, though I don't like the explosion of new operators. I'd prefer the C# syntax like check(expression), wrap(expression), saturate(expression). You maybe like this: ---small test

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-24 Thread Don via Digitalmars-d
On Monday, 24 November 2014 at 16:00:53 UTC, ketmar via Digitalmars-d wrote: On Mon, 24 Nov 2014 12:54:58 + Don via Digitalmars-d digitalmars-d@puremagic.com wrote: In D, 1u - 2u 0u. This is defined behaviour, not an overflow. this *is* overflow. D just has overflow result defined.

Re: @property method needs ()

2014-11-24 Thread ketmar via Digitalmars-d-learn
On Mon, 24 Nov 2014 06:56:08 + Andre via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Hi, in following example the @property method needs the () otherwise compiler error for row 24 is thrown. I cannot judge, whether the compiler behaves correct or not. Kind regards

Re: @property method needs ()

2014-11-24 Thread via Digitalmars-d-learn
On Monday, 24 November 2014 at 08:35:08 UTC, ketmar via Digitalmars-d-learn wrote: On Mon, 24 Nov 2014 06:56:08 + Andre via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Hi, in following example the @property method needs the () otherwise compiler error for row 24 is

Re: print yyyy-mm-dd

2014-11-24 Thread Suliman via Digitalmars-d-learn
Is there any way to set separator? For example I want use '/' or ':'?

Re: print yyyy-mm-dd

2014-11-24 Thread Suliman via Digitalmars-d-learn
And could anybody explain me how the cast is work. How to understand which types to which may be casted?

Re: print yyyy-mm-dd

2014-11-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, November 24, 2014 10:33:16 Suliman via Digitalmars-d-learn wrote: Is there any way to set separator? For example I want use '/' or ':'? No. toISOString and toISOExtString support the ISO and Extended ISO formats from the ISO standard, and std.datetime does not currently support

Re: print yyyy-mm-dd

2014-11-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, November 24, 2014 10:38:55 Suliman via Digitalmars-d-learn wrote: And could anybody explain me how the cast is work. How to understand which types to which may be casted? Look at the documentation for opCast. That's how the casting is done. But what it comes down to is SysTime -

Re: @property method needs ()

2014-11-24 Thread Andre via Digitalmars-d-learn
Thanks a lot for the info. Kind regards André On Monday, 24 November 2014 at 09:26:16 UTC, Marc Schütz wrote: On Monday, 24 November 2014 at 08:35:08 UTC, ketmar via Digitalmars-d-learn wrote: a known thing. not sure if this is a known *bug* (seems that almost nobody cares). compiler is

projections in D

2014-11-24 Thread Ramon via Digitalmars-d-learn
what range/algorithm allows me to make projections from one sequence to another? that is, in C#, this is the Select method (http://msdn.microsoft.com/en-us/library/vstudio/bb548891%28v=vs.100%29.aspx) example in C#: class ProjectionWanted { public int field1 { get; set; } public int

Re: projections in D

2014-11-24 Thread bearophile via Digitalmars-d-learn
Ramon: example in C#: class ProjectionWanted { public int field1 { get; set; } public int field2 { get; set; } public int field3 { get; set; } } void Foo(ListProjectionWanted list) { var list_projected = list.Select(l = new { l.field1, l.field2 }); // list_projected elements now

Re: projections in D

2014-11-24 Thread Ramon via Digitalmars-d-learn
What is the difference between lazy and eager ranges? (I guess, the lazy one has not yet queried the elements)

Re: projections in D

2014-11-24 Thread bearophile via Digitalmars-d-learn
On Monday, 24 November 2014 at 15:44:02 UTC, Ramon wrote: What is the difference between lazy and eager ranges? (I guess, the lazy one has not yet queried the elements) The lazy returns a range that once iterated gives the results one at a time (so the function allocates no heap memory).

Re: Sum informations in file....

2014-11-24 Thread Suliman via Digitalmars-d-learn
I can't understand why foreach loop produce every line by line, while it's fuctional analog print lines on one string: foreach(f; file.byLine()) { writeln(f); } auto file = File(foo.txt,r); file .byLine() .writeln; file content: - first sring second string -

Re: Sum informations in file....

2014-11-24 Thread ketmar via Digitalmars-d-learn
On Mon, 24 Nov 2014 19:04:34 + Suliman via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I can't understand why foreach loop produce every line by line, while it's fuctional analog print lines on one string: the two samples are not the same, they doing completely different

Re: Sum informations in file....

2014-11-24 Thread Ali Çehreli via Digitalmars-d-learn
On 11/24/2014 11:04 AM, Suliman wrote: I can't understand why foreach loop produce every line by line, while it's fuctional analog print lines on one string: foreach(f; file.byLine()) { writeln(f); f is a char[] and writeln prints all strings as their contents i.e. first string is

Re: Sum informations in file....

2014-11-24 Thread Ali Çehreli via Digitalmars-d-learn
On 11/24/2014 11:30 AM, ketmar via Digitalmars-d-learn wrote: File.byLine returns *output* *range*. Although the range is used for outputting, it is still an InputRange. :) Ali

Re: Sum informations in file....

2014-11-24 Thread ketmar via Digitalmars-d-learn
On Mon, 24 Nov 2014 11:41:43 -0800 Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On 11/24/2014 11:30 AM, ketmar via Digitalmars-d-learn wrote: File.byLine returns *output* *range*. Although the range is used for outputting, it is still an InputRange. :) ah,

Re: Sum informations in file....

2014-11-24 Thread Rene Zwanenburg via Digitalmars-d-learn
On Monday, 24 November 2014 at 20:23:57 UTC, Suliman wrote: thanks! But how I can skip first line? My varian: auto lines = foo.txt.File .byLine .filter!(f=f[0] != f[0]); With 'drop' from std.range: auto lines = foo.txt.File .byLine

Re: Sum informations in file....

2014-11-24 Thread Suliman via Digitalmars-d-learn
Thanks! But is there any way to do it with std.algorithm? Can be skipOver used for it?

DerelictOrg and SDL_Mixer

2014-11-24 Thread torea via Digitalmars-d-learn
Hi all, I'm playing a bit with D and SDL using DerelictOrg on debian 6. I've installed SDL2, SDL_mixer2 and the latest packages DerelictUtil and DerelictSDL2. I can display some stuffs and interact with the keys. Now I'm trying to add music and sounds but each time I try to access a function

opEquals unsafe? Please tell me this isnt true...

2014-11-24 Thread Eric via Digitalmars-d-learn
@safe class Y { } @safe class X { } @safe class Z { int x; this() { if (typeid(X) == typeid(Y)) x = 1; // Compile Error else x = 2; } } void main() { new Z; } // test.d(19): Error: safe function 'test.Z.this' // cannot call system function 'object.opEquals'

Something between a scalar and an enum

2014-11-24 Thread bearophile via Digitalmars-d-learn
An enumeration contains a small number of distinct elements: enum Colors { red, green, yellow, brown } While an integral numeric value encodes a scalar: uint x; x = 120; x++; A sufficiently common pattern in my code is to have something intermediate: that has a small group of special

A nice D coding pattern

2014-11-24 Thread bearophile via Digitalmars-d-learn
In some D programs I'm using this coding pattern: struct Foo { // Instance fields here. @disable this(); this(in string[] data) pure @safe in { // Many pre-conditions here. } out(result) { // Some post-conditions here. } body { // ... }

Re: DerelictOrg and SDL_Mixer

2014-11-24 Thread Jack via Digitalmars-d-learn
On Monday, 24 November 2014 at 21:19:40 UTC, torea wrote: Hi all, I'm playing a bit with D and SDL using DerelictOrg on debian 6. I've installed SDL2, SDL_mixer2 and the latest packages DerelictUtil and DerelictSDL2. I can display some stuffs and interact with the keys. Now I'm trying to add

Re: DerelictOrg and SDL_Mixer

2014-11-24 Thread torea via Digitalmars-d-learn
On Monday, 24 November 2014 at 23:27:58 UTC, Jack wrote: It's a common error but did you load the Mixer and SDL libraries? DerelictSDL2Mixer.load(); DerelictSDL2.load(); And some code or output from gdb would be most helpful. Oh.. I didn't know about the DerelictSDL2Mixer.load()! I thought

Re: opEquals unsafe? Please tell me this isnt true...

2014-11-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, November 24, 2014 22:12:08 Eric via Digitalmars-d-learn wrote: @safe class Y { } @safe class X { } @safe class Z { int x; this() { if (typeid(X) == typeid(Y)) x = 1; // Compile Error else x = 2; } } void main() { new Z; } //

Re: opEquals unsafe? Please tell me this isnt true...

2014-11-24 Thread Eric via Digitalmars-d-learn
On Tuesday, 25 November 2014 at 02:48:43 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: On Monday, November 24, 2014 22:12:08 Eric via Digitalmars-d-learn wrote: @safe class Y { } @safe class X { } @safe class Z { int x; this() { if (typeid(X) == typeid(Y)) x =

Re: opEquals unsafe? Please tell me this isnt true...

2014-11-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 25 November 2014 at 03:42:50 UTC, Eric wrote: I'm finding it really hard to write robust classes in D due to all the problems with Object. I wish Object didn't have any methods. One thing I do is kinda act as if it didn't and make my own interfaces instead.

[Issue 13770] New: can't mix template class and normal class

2014-11-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13770 Issue ID: 13770 Summary: can't mix template class and normal class Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement

[Issue 13771] New: any language support capture acquire type?

2014-11-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13771 Issue ID: 13771 Summary: any language support capture acquire type? Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement

[Issue 13772] New: template capture error

2014-11-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13772 Issue ID: 13772 Summary: template capture error Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1

[Issue 13772] template capture error

2014-11-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13772 --- Comment #1 from galaxylang galaxyl...@gmail.com --- //there are some copy problem //now DMD implement follow two case no difference //classP(T:U!(V,X),alias U,V){}===classP(T:U!(V,X),alias U,V...){} class U(V...) { } class