Re: byLine(n)?

2017-06-10 Thread Stanislav Blinov via Digitalmars-d-learn
On Sunday, 11 June 2017 at 05:36:08 UTC, helxi wrote: I was writing a program that reads and prints the first nth lines to the stdout: import std.stdio; void main(string[] args) { import std.algorithm, std.range; import std.conv; stdin.byLine.take(args[1].to!ulong).each!writeln; }

byLine(n)?

2017-06-10 Thread helxi via Digitalmars-d-learn
I was writing a program that reads and prints the first nth lines to the stdout: import std.stdio; void main(string[] args) { import std.algorithm, std.range; import std.conv; stdin.byLine.take(args[1].to!ulong).each!writeln; } As far as I understand the stdin.byLine.take(args[1].t

Re: brew install dmd

2017-06-10 Thread Seb via Digitalmars-d-learn
On Sunday, 11 June 2017 at 03:48:57 UTC, Joel wrote: On Sunday, 11 June 2017 at 02:38:21 UTC, Mike Parker wrote: On Sunday, 11 June 2017 at 01:30:37 UTC, Joel wrote: but still 2.074.0 (not 74.1) Joels-MacBook-Pro:Testing joelchristensen$ dmd DMD64 D Compiler v2.074.0 It's probably related

Re: brew install dmd

2017-06-10 Thread Joel via Digitalmars-d-learn
On Sunday, 11 June 2017 at 03:54:05 UTC, Mike Parker wrote: On Sunday, 11 June 2017 at 03:48:57 UTC, Joel wrote: curl https://i.dlang.io | bash -s But I'm not sure about doing this. I'm don't what that means, but Homebrew is giving you 2.074.1, it's just that the binary has the wrong versi

Re: brew install dmd

2017-06-10 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 11 June 2017 at 03:48:57 UTC, Joel wrote: curl https://i.dlang.io | bash -s But I'm not sure about doing this. I'm don't what that means, but Homebrew is giving you 2.074.1, it's just that the binary has the wrong version number compiled in.

Re: brew install dmd

2017-06-10 Thread Joel via Digitalmars-d-learn
On Sunday, 11 June 2017 at 02:38:21 UTC, Mike Parker wrote: On Sunday, 11 June 2017 at 01:30:37 UTC, Joel wrote: but still 2.074.0 (not 74.1) Joels-MacBook-Pro:Testing joelchristensen$ dmd DMD64 D Compiler v2.074.0 It's probably related to this: http://forum.dlang.org/post/abyacihlxtcphnhz

Re: brew install dmd

2017-06-10 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 11 June 2017 at 01:30:37 UTC, Joel wrote: but still 2.074.0 (not 74.1) Joels-MacBook-Pro:Testing joelchristensen$ dmd DMD64 D Compiler v2.074.0 It's probably related to this: http://forum.dlang.org/post/abyacihlxtcphnhzi...@forum.dlang.org

brew install dmd

2017-06-10 Thread Joel via Digitalmars-d-learn
but still 2.074.0 (not 74.1) I'm not that familier brew. I've tried `brew upgrade` and `brew update`. Joels-MacBook-Pro:Testing joelchristensen$ brew upgrade dmd ==> Upgrading 1 outdated package, with result: dmd 2.074.1 ==> Upgrading dmd ==> Downloading https://homebrew.bintray.com/bottles/d

Re: Dub or Dmd trying to use some funny path to find linker.exe

2017-06-10 Thread Mike Wey via Digitalmars-d-learn
On 06/10/2017 07:04 PM, WhatMeWorry wrote: Dub or Dmd dies when it can't find the linker. Like so: C:\Users\kheaser\Git\Delivery\projects\00_01_print_ogl_ver>dub run --arch=x86_64 --force Performing "debug" build using dmd for x86_64. derelict-util 2.0.6: building configuration "library"...

Re: when I run dub within git bash, dub prompts are not displayed. For instance...

2017-06-10 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 10 June 2017 at 16:11:31 UTC, WhatMeWorry wrote: kheaser@IT-ASST-SB MINGW64 /c/Users/kheaser/Git/Delivery/projects (master) $ dub init 00_01_print_ogl_ver ... All this white space here is me just pressing the Enter key ... to get the default values. If the problem is that the t

Re: std.stdio.stderr

2017-06-10 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2017-06-10 at 16:45 +, Antonio Corbi via Digitalmars-d- learn wrote: > […] > > It seems to work for me with a dumb example: […] Spurred on by your report of success, I discovered my error. D treats a char[1024] as 1024 characters when using the %s format specifier. I had to use fromSt

Dub or Dmd trying to use some funny path to find linker.exe

2017-06-10 Thread WhatMeWorry via Digitalmars-d-learn
Dub or Dmd dies when it can't find the linker. Like so: C:\Users\kheaser\Git\Delivery\projects\00_01_print_ogl_ver>dub run --arch=x86_64 --force Performing "debug" build using dmd for x86_64. derelict-util 2.0.6: building configuration "library"... derelict-al 1.0.3: building configuration "l

Re: std.stdio.stderr

2017-06-10 Thread Antonio Corbi via Digitalmars-d-learn
On Saturday, 10 June 2017 at 16:10:18 UTC, Russel Winder wrote: It appears that std.stdio.stderr does not wor exactly as stdio stderr does. In particular std.stdio.stderr.writef(…) does not work as fprintf(stderr…) does. Some code I am porting from C++ to D makes use of ANSI escape codes to go

when I run dub within git bash, dub prompts are not displayed. For instance...

2017-06-10 Thread WhatMeWorry via Digitalmars-d-learn
kheaser@IT-ASST-SB MINGW64 /c/Users/kheaser/Git/Delivery/projects (master) $ dub init 00_01_print_ogl_ver ... All this white space here is me just pressing the Enter key ... to get the default values. Package recipe format (sdl/json) [json]: Name [00_01_print_ogl_ver]: Description [A minim

std.stdio.stderr

2017-06-10 Thread Russel Winder via Digitalmars-d-learn
It appears that std.stdio.stderr does not wor exactly as stdio stderr does. In particular std.stdio.stderr.writef(…) does not work as fprintf(stderr…) does. Some code I am porting from C++ to D makes use of ANSI escape codes to go up a line and overwrite what was there, as well as change colours.

Re: Need way to compare classes, and primitive types in bst Template

2017-06-10 Thread Mark via Digitalmars-d-learn
On Saturday, 10 June 2017 at 14:35:48 UTC, ag0aep6g wrote: ... Just that you shouldn't take my version of addNode and rely on it without double checking that it's correct. Ah, Okay. I rechecked that everything is working. The size is correct, and the membership is correct for every insert/dele

Re: Need way to compare classes, and primitive types in bst Template

2017-06-10 Thread ag0aep6g via Digitalmars-d-learn
On 06/10/2017 06:57 AM, Mark wrote: On Friday, 9 June 2017 at 15:12:04 UTC, ag0aep6g wrote: ... Note that this is only supposed to show how to do the special casing for classes. addNode probably doesn't do exactly what it's supposed to do in your tree. I'm not sure what you mean by this?

Re: Is D slow?

2017-06-10 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 10 June 2017 at 14:14:53 UTC, Steven Schveighoffer wrote: I can confirm on my system, ldc with bounds check off was at least twice as slow as with just -release. Definitely seems like a bug -Steve Ya, see https://github.com/ldc-developers/ldc/issues/2161

Re: Is D slow?

2017-06-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 10 June 2017 at 13:43:48 UTC, Nicholas Wilson wrote: On Saturday, 10 June 2017 at 12:44:07 UTC, Honey wrote: On Saturday, 10 June 2017 at 12:23:05 UTC, Nicholas Wilson wrote: [...] Are you saying that introducing additional checks enables the optimizer to eliminate more or more

Re: Is D slow?

2017-06-10 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 10 June 2017 at 12:44:07 UTC, Honey wrote: On Saturday, 10 June 2017 at 12:23:05 UTC, Nicholas Wilson wrote: On Saturday, 10 June 2017 at 12:16:34 UTC, Honey wrote: Is it expected that turning off bounds checking can lead to a performance decrease? Yes, with it on you are doing a

Re: Is D slow?

2017-06-10 Thread Honey via Digitalmars-d-learn
On Saturday, 10 June 2017 at 12:23:05 UTC, Nicholas Wilson wrote: On Saturday, 10 June 2017 at 12:16:34 UTC, Honey wrote: Is it expected that turning off bounds checking can lead to a performance decrease? Yes, with it on you are doing an "is the index <= the length" for every array access. N

Re: Is D slow?

2017-06-10 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 10 June 2017 at 12:16:34 UTC, Honey wrote: On Saturday, 10 June 2017 at 11:53:44 UTC, Johan Engelen wrote: `-release` should be synonymous with `-release -boundscheck=off`. Nope it's not. http://www.digitalmars.com/d/archives/digitalmars/D/What_s_the_deal_with_-boundscheck_260237.

Re: Is D slow?

2017-06-10 Thread Honey via Digitalmars-d-learn
On Saturday, 10 June 2017 at 11:53:44 UTC, Johan Engelen wrote: `-release` should be synonymous with `-release -boundscheck=off`. Nope it's not. http://www.digitalmars.com/d/archives/digitalmars/D/What_s_the_deal_with_-boundscheck_260237.html Thank you for clarifying that point. Is it expecte

Re: Is D slow?

2017-06-10 Thread Honey via Digitalmars-d-learn
On Saturday, 10 June 2017 at 10:59:24 UTC, Steven Schveighoffer wrote: I wrote it like this, which confirms that it's indeed bringToFront (I tried your getTransitionIndex function, but that didn't change timings at all): void insertionSort(alias Less, Range)(Range r) if (hasLength!Range && isR

Re: Is D slow?

2017-06-10 Thread Johan Engelen via Digitalmars-d-learn
On Saturday, 10 June 2017 at 11:43:06 UTC, Johan Engelen wrote: On Friday, 9 June 2017 at 16:21:22 UTC, Honey wrote: What seems particularly strange to me is that -boundscheck=off leads to a performance decrease. Strange indeed. `-release` should be synonymous with `-release -boundscheck=off`

Re: Is D slow?

2017-06-10 Thread Johan Engelen via Digitalmars-d-learn
On Friday, 9 June 2017 at 16:21:22 UTC, Honey wrote: What seems particularly strange to me is that -boundscheck=off leads to a performance decrease. Strange indeed. `-release` should be synonymous with `-release -boundscheck=off`. Investigating... - Johan

Re: Is D slow?

2017-06-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/10/17 5:00 AM, Honey wrote: On Friday, 9 June 2017 at 23:10:28 UTC, Ali Çehreli wrote: You would get the exact performance if you implemented e.g. with pointers. Your test has been very valuable for exposing an embarrassing performance issue. :) I can confirm that, after changing implemen

Re: What is the best way to include this file from the runtime libraries?

2017-06-10 Thread ulyssesdwolfe via Digitalmars-d-learn
On Saturday, 10 June 2017 at 10:07:54 UTC, rikki cattermole wrote: You found it. Ok Thanks :)

Re: What is the best way to include this file from the runtime libraries?

2017-06-10 Thread rikki cattermole via Digitalmars-d-learn
On 10/06/2017 11:06 AM, ulyssesdwolfe wrote: Hi I am trying to hook up an app to log to /var/log through the rsyslog daemon and it seems I need this file https://github.com/dlang/druntime/blob/master/src/core/sys/posix/syslog.d but I am not sure what the correct way to include files from the ru

What is the best way to include this file from the runtime libraries?

2017-06-10 Thread ulyssesdwolfe via Digitalmars-d-learn
Hi I am trying to hook up an app to log to /var/log through the rsyslog daemon and it seems I need this file https://github.com/dlang/druntime/blob/master/src/core/sys/posix/syslog.d but I am not sure what the correct way to include files from the runtime libs is. Right now I am just doing im

Re: Is D slow?

2017-06-10 Thread Honey via Digitalmars-d-learn
On Friday, 9 June 2017 at 23:10:28 UTC, Ali Çehreli wrote: You would get the exact performance if you implemented e.g. with pointers. Your test has been very valuable for exposing an embarrassing performance issue. :) I can confirm that, after changing implementation to the following, perform