Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:25:04 UTC, Fredrik Boulund wrote: On Monday, 14 September 2015 at 14:14:18 UTC, John Colvin wrote: what system are you on? What are the error messages you are getting? I really appreciate your will to try to help me out. This is what ldd shows on the latest

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 13:05:32 UTC, Andrea Fontana wrote: On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: [...] Also if problem probabily is i/o related, have you tried with: -O -inline -release -noboundscheck ? -inline in particular is likely to have a strong

Re: chaining chain Result and underlying object of chain

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 15:30:14 UTC, Ali Çehreli wrote: On 09/14/2015 08:01 AM, Laeeth Isharc wrote: > I was trying to use the same variable eg > >auto chain1 = chain("foo", "bar"); >chain1 = chain(chain1, "baz"); [...] > It may be that the type of chain1 > and chain2

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:35:26 UTC, Fredrik Boulund wrote: On Monday, 14 September 2015 at 14:28:41 UTC, John Colvin wrote: Yup, glibc is too old for those binaries. What does "ldd --version" say? It says "ldd (GNU libc) 2.12". Hmm... The most recent version in RHEL's repo is

Re: how do I check if a member of a T has a member ?

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 15:04:00 UTC, Laeeth Isharc wrote: On Monday, 14 September 2015 at 14:21:12 UTC, John Colvin wrote: On Monday, 14 September 2015 at 14:05:01 UTC, Laeeth Isharc wrote: On Sunday, 13 September 2015 at 17:34:11 UTC, BBasile wrote: On Sunday, 13 September 2015 at

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 16:33:23 UTC, Rikki Cattermole wrote: On 15/09/15 12:30 AM, Fredrik Boulund wrote: [...] A lot of this hasn't been covered I believe. http://dpaste.dzfl.pl/f7ab2915c3e1 1) You don't need to convert char[] to string via to. No. Too much. Cast it. Not a good

Re: Release D 2.068.1

2015-09-14 Thread John Colvin via Digitalmars-d-announce
On Monday, 14 September 2015 at 20:14:45 UTC, Jack Stouffer wrote: On Monday, 14 September 2015 at 17:51:59 UTC, Martin Nowak wrote: What platform are you on? I'm on OS X, using the homebrew version of DMD. And homebrew is telling me that I have 2.068.1 installed $ brew install dmd

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 17:51:43 UTC, CraigDillabaugh wrote: On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: [...] I am going to go off the beaten path here. If you really want speed for a file like this one way of getting that is to read the file in as a

Re: best way to memoize a range?

2015-09-11 Thread John Colvin via Digitalmars-d-learn
On Friday, 11 September 2015 at 13:09:33 UTC, Laeeth Isharc wrote: obviously it's trivial to do with a little aa cache. and I know I can memoize a function, and turn the memoized version into an infinite range. but suppose I have a lazy function that returns a finite range, and its expensive

Re: std.experimental.testing formal review

2015-09-11 Thread John Colvin via Digitalmars-d
On Friday, 11 September 2015 at 11:27:59 UTC, Atila Neves wrote: On Friday, 11 September 2015 at 10:02:22 UTC, NVolcz wrote: Is it possible to categorize tests? D's module system does that already. Along with things like version(unittestFeatureA) or version(unittestPrecision)

Re: Huge output size for simple programs

2015-09-11 Thread John Colvin via Digitalmars-d-learn
On Friday, 11 September 2015 at 11:15:33 UTC, NX wrote: I compile a simple hello world program in C and the results: hello_world.o -> 1.5 KB hello_world (linux executable) -> 8.5 KB Then I compile a simple hello world program in D (using DMD) and the results: hello_world.o -> 9.3 KB

Re: Member function pointers

2015-09-10 Thread John Colvin via Digitalmars-d
On Thursday, 10 September 2015 at 01:52:17 UTC, digitalmars.D wrote: On 10 September 2015 at 04:55, Walter Bright via Digitalmars-d wrote: On 6/10/2013 7:33 AM, Manu wrote: [...] Sorry to say, your n.g. poster is back to its old tricks :-) We've resolved

Re: Article: More hidden treasure in the D standard library

2015-08-31 Thread John Colvin via Digitalmars-d-announce
On Monday, 31 August 2015 at 16:09:02 UTC, Gary Willoughby wrote: I've written a new article on D here: http://nomad.so/2015/08/more-hidden-treasure-in-the-d-standard-library/ Hopefully to drive other programmers to investigate D. It's a continuation of a similar one I wrote a few months ago

Re: Article: More hidden treasure in the D standard library

2015-08-31 Thread John Colvin via Digitalmars-d-announce
On Monday, 31 August 2015 at 16:22:36 UTC, Gary Willoughby wrote: On Monday, 31 August 2015 at 16:16:15 UTC, John Colvin wrote: why the use of `input.text` instead of just `input` on line 14 of the fizz buzz example? It doesn't compile. Error: mismatched function return type inference of int

Re: Dynamic arrays

2015-08-31 Thread John Colvin via Digitalmars-d-announce
On Monday, 31 August 2015 at 21:29:09 UTC, anonymous wrote: On Monday 31 August 2015 23:09, Minas Mina wrote: I have started a series of tutorials in D. This is my latest blog post, which is about dynamic arrays: http://minas-mina.com/2015/08/31/dynamic-arrays/ Constructive criticism is

Challenge

2015-08-30 Thread John Colvin via Digitalmars-d
import std.algorithm, std.range; auto foo(R)(R a, immutable int b) { return a.map!(x = x + b); } unittest @nogc @safe { int[] test = [1,2,3]; assert(test.foo(3).equal(only(4,5,6))); } Challenge: reimplement `foo` such that above unittest will compile. No cheating with malloc etc.

Re: Challenge

2015-08-30 Thread John Colvin via Digitalmars-d
On Sunday, 30 August 2015 at 11:21:34 UTC, Russel Winder wrote: On Sun, 2015-08-30 at 10:38 +, John Colvin via Digitalmars-d wrote: On Sunday, 30 August 2015 at 10:15:14 UTC, John Colvin wrote: [...] Ok, so now I feel stupid. Not only was the unittest I gave above broken anyway, I

Re: Challenge

2015-08-30 Thread John Colvin via Digitalmars-d
On Sunday, 30 August 2015 at 10:15:14 UTC, John Colvin wrote: import std.algorithm, std.range; auto foo(R)(R a, immutable int b) { return a.map!(x = x + b); } unittest @nogc @safe { int[] test = [1,2,3]; assert(test.foo(3).equal(only(4,5,6))); } Challenge: reimplement `foo` such

Re: stuck on opDiv / opBinary

2015-08-30 Thread John Colvin via Digitalmars-d-learn
On Sunday, 30 August 2015 at 17:02:58 UTC, Spacen Jasset wrote: I have just added an opDiv to this class, but it doesn't seem to pick it up. math/vector.d(30): Error: 'this /= mag' is not a scalar, it is a Vector3 I can't see why that is, becuase my opMul works in the same place. Can anyone

Re: Pointer to std.container.Array data for C library

2015-08-28 Thread John Colvin via Digitalmars-d-learn
On Friday, 28 August 2015 at 18:31:00 UTC, Oleg wrote: On Friday, 28 August 2015 at 18:21:04 UTC, John Colvin wrote: On Friday, 28 August 2015 at 17:45:21 UTC, Oleg wrote: Hello! Is it possible to get pointer to a data in std.container.Array like .ptr from an array? I need to pass a pointer

Re: Pointer to std.container.Array data for C library

2015-08-28 Thread John Colvin via Digitalmars-d-learn
On Friday, 28 August 2015 at 17:45:21 UTC, Oleg wrote: Hello! Is it possible to get pointer to a data in std.container.Array like .ptr from an array? I need to pass a pointer to some C function (from DerelictGL3 binding) and avoid GC allocation. Thank you! I'm pretty sure you can just take

Re: vibe.d - cannot allocate memory in static TLS block

2015-08-27 Thread John Colvin via Digitalmars-d
On Thursday, 27 August 2015 at 15:40:20 UTC, ddos wrote: On Thursday, 27 August 2015 at 15:16:25 UTC, John Colvin wrote: I think your problem is that you need to initialise the D runtime. Perhaps adding a call to http://dlang.org/phobos/core_runtime.html#.Runtime.initialize inside OnInit will

Re: vibe.d - cannot allocate memory in static TLS block

2015-08-27 Thread John Colvin via Digitalmars-d
On Thursday, 27 August 2015 at 13:08:18 UTC, ddos wrote: On Thursday, 27 August 2015 at 11:34:36 UTC, John Colvin wrote: P.S. this would be better asked in http://forum.dlang.org/group/learn or http://forum.rejectedsoftware.com made a thread before on the vibe forum too, see here

Re: dmd codegen improvements

2015-08-27 Thread John Colvin via Digitalmars-d
On Thursday, 27 August 2015 at 13:49:18 UTC, Bruno Medeiros wrote: On 19/08/2015 09:22, Dmitry Olshansky wrote: I'm interested in ways to reduce that gap. [...] Replace the backend with GDC or LLVM? :-P Oh come on - LLVM was an inferiour backend for some time. So what? Let us no work on

Re: vibe.d - cannot allocate memory in static TLS block

2015-08-27 Thread John Colvin via Digitalmars-d
On Thursday, 27 August 2015 at 11:33:02 UTC, John Colvin wrote: On Thursday, 27 August 2015 at 09:06:54 UTC, ddos wrote: when i import the vibe.d module my project it dies with the error message cannot allocate memory in static TLS block compiled as dynamic library on debian x86 name: alice,

Re: vibe.d - cannot allocate memory in static TLS block

2015-08-27 Thread John Colvin via Digitalmars-d
On Thursday, 27 August 2015 at 09:06:54 UTC, ddos wrote: when i import the vibe.d module my project it dies with the error message cannot allocate memory in static TLS block compiled as dynamic library on debian x86 name: alice, description: A minimal D application., copyright: Copyright ©

Re: Moving forward with work on the D language and foundation

2015-08-27 Thread John Colvin via Digitalmars-d-announce
On Wednesday, 26 August 2015 at 15:48:49 UTC, Russel Winder wrote: Even just for marketing reasons, it would be better if the DlangScience team on GitHub was more than one person. On Thursday, 27 August 2015 at 04:32:21 UTC, Dmitry Olshansky wrote: All of you guys should be displayed here on

Re: Moving forward with work on the D language and foundation

2015-08-26 Thread John Colvin via Digitalmars-d-announce
On Wednesday, 26 August 2015 at 05:51:06 UTC, Dmitry Olshansky wrote: On 25-Aug-2015 23:04, bachmeier wrote: On Tuesday, 25 August 2015 at 19:29:06 UTC, Daniel Kozák wrote: I can't agree more. OK maybe I would add this https://twitter.com/kozzi11/status/636190895856091136 ;-) This is a big

Re: DCD v0.7.0-rc1

2015-08-25 Thread John Colvin via Digitalmars-d-announce
On Friday, 21 August 2015 at 10:15:09 UTC, Brian Schott wrote: https://github.com/Hackerpilot/DCD/releases/tag/v0.7.0-rc1 If nothing else comes up I'll tag 0.7.0 Monday. DCD is an editor-independent auto-completion program for D code. Read more here: https://github.com/Hackerpilot/DCD brew

Re: Casting double to ulong weirdness

2015-08-24 Thread John Colvin via Digitalmars-d
On Monday, 24 August 2015 at 18:06:08 UTC, rumbu wrote: BTW, 1.2 and 12.0 are directly representable as double 12.0 is representable, but I'm pretty sure, if you work it out, 1.2 isn't.

Re: extern opaque struct

2015-08-24 Thread John Colvin via Digitalmars-d
On Monday, 24 August 2015 at 04:08:28 UTC, Daniel Murphy wrote: John Colvin wrote in message news:uhpgjffttsuqeswyj...@forum.dlang.org... Let's say I have some C headers that have code like this in: extern struct UndeclaredStruct blah; Undeclared *p = blah; which would naïvely translate to

Re: Digger 2.3 verstr.h problem

2015-08-24 Thread John Colvin via Digitalmars-d-learn
On Monday, 24 August 2015 at 09:13:56 UTC, Robert M. Münch wrote: On 2015-08-23 16:23:57 +, John Colvin said: almost certainly a consequence of the recent switchover to the dmd frontend being written in D. Have you tried building the latest Digger git HEAD first? If that doesn't work I

Re: Digger 2.3 verstr.h problem

2015-08-23 Thread John Colvin via Digitalmars-d-learn
On Sunday, 23 August 2015 at 11:27:32 UTC, Robert M. Münch wrote: Hi, just trying to build the latest DMD with Digger 2.3 and get this: uffer.d root/port.d root/response.d root/rmem.d root/rootobject.d root/speller.d root/stringtable.d newdelete.o glue.a backend.a globals.d(293): Error: file

Re: How to use ranges?

2015-08-23 Thread John Colvin via Digitalmars-d-learn
Generally, dynamic arrays / slices are random-access ranges. Narrow strings (string/wstring/char[]/wchar[]/...) are a notable exception to this. They are dynamic arrays of UTF-8/UTF-16 code units. But they're not random-access ranges of Unicode code units. Instead, they're _forward_ ranges of

order of declaration/definition

2015-08-23 Thread John Colvin via Digitalmars-d-learn
enum A = 1; enum B = C; //Error static if(A) enum C = 0; enum D = C; //OK Is order supposed to matter here?

extern opaque struct

2015-08-23 Thread John Colvin via Digitalmars-d
Let's say I have some C headers that have code like this in: extern struct UndeclaredStruct blah; Undeclared *p = blah; which would naïvely translate to D as: struct UndeclaredStruct; extern UndeclaredStruct blah; auto p = blah; which doesn't compile. Why not? Neither the size nor any default

Re: extern opaque struct

2015-08-23 Thread John Colvin via Digitalmars-d
On Sunday, 23 August 2015 at 22:20:26 UTC, John Colvin wrote: Let's say I have some C headers that have code like this in: extern struct UndeclaredStruct blah; Undeclared *p = blah; which would naïvely translate to D as: struct UndeclaredStruct; extern UndeclaredStruct blah; auto p = blah;

Re: flush MessageBox

2015-08-21 Thread John Colvin via Digitalmars-d-learn
On Friday, 21 August 2015 at 10:43:22 UTC, Chris wrote: On Thursday, 20 August 2015 at 15:57:47 UTC, John Colvin wrote: On Thursday, 20 August 2015 at 15:25:57 UTC, Chris wrote: Is there a way to flush a thread's message box other than aborting the thread? MailBox is private:

Re: flush MessageBox

2015-08-21 Thread John Colvin via Digitalmars-d-learn
On Friday, 21 August 2015 at 14:35:53 UTC, Chris wrote: On Friday, 21 August 2015 at 12:59:09 UTC, John Colvin wrote: [...] Wouldn't it be easier to have a library function that can empty the mailbox immediately? It's a waste of time to have all items in the mailbox crash against a wall,

Re: Amazing brand spanking new programming concept: Parameter Paths!

2015-08-21 Thread John Colvin via Digitalmars-d
On Friday, 21 August 2015 at 00:29:35 UTC, TheHamster wrote: Parameter paths, a thousand words summed up: void foo(p1, p2|p3|p4, p5|p6, |*p7|p8){ ... } [...] Could you give an example of where this enables something really new and/or much more convenient than using templates?

Re: New to D - playing with Thread and false Sharing

2015-08-21 Thread John Colvin via Digitalmars-d-learn
On Friday, 21 August 2015 at 02:44:50 UTC, Rikki Cattermole wrote: On 8/21/2015 3:37 AM, Dejan Lekic wrote: Keep in mind that in D everything is thread-local by default! :) For shared resources use __gshared or shared (although I do not know for sure whether shared works or not). Note:

Re: Presentation Intro to D: What works?

2015-08-20 Thread John Colvin via Digitalmars-d
On Wednesday, 19 August 2015 at 20:15:48 UTC, qznc wrote: On Thursday, 25 June 2015 at 12:39:11 UTC, qznc wrote: [...] Presentation done. Only six people in the audience, but they appreciated it. 5/6 already had heard about D. 3/6 had played with it. If you are interested in my slides:

Re: flush MessageBox

2015-08-20 Thread John Colvin via Digitalmars-d-learn
On Thursday, 20 August 2015 at 15:25:57 UTC, Chris wrote: Is there a way to flush a thread's message box other than aborting the thread? MailBox is private: https://github.com/D-Programming-Language/phobos/blob/master/std/concurrency.d#L1778 flush from inside the thread? You could call

Re: Compiletime Vs Runtime bencmarks

2015-08-18 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 18 August 2015 at 07:16:32 UTC, D_Learner wrote: On Monday, 17 August 2015 at 22:01:32 UTC, John Colvin wrote: On Monday, 17 August 2015 at 17:48:22 UTC, D_Learner wrote: On Monday, 17 August 2015 at 14:52:18 UTC, Edwin van Leeuwen wrote: [...] The surprisingly, the D-profiler

Re: ReturnType of lambda templates

2015-08-18 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 18 August 2015 at 14:25:34 UTC, Roland Hadinger wrote: Hi! Suppose I wanna do this (which already works, which is why D is pretty cool): import std.traits; import std.typecons : Nullable; // Retrofit Nullable to allow for monadic chaining // auto apply( alias

Re: Compiletime Vs Runtime bencmarks

2015-08-17 Thread John Colvin via Digitalmars-d-learn
On Monday, 17 August 2015 at 17:48:22 UTC, D_Learner wrote: On Monday, 17 August 2015 at 14:52:18 UTC, Edwin van Leeuwen wrote: [...] The surprisingly, the D-profiler gives plausible results:- Algorithm1 2921 int rtime_pre.bm_rmatch (runtime ) 2122 int ctime_pre.bm_cmatch

Re: A couple questions about a simple project

2015-08-17 Thread John Colvin via Digitalmars-d-learn
On Monday, 17 August 2015 at 15:05:56 UTC, Andre Polykanine wrote: Hi everyone, I'm new to D (I'm learning it by reading the great online book by Ali Çehreli - thank you very much for it, sir!), and, more than that, programming is my hobby, so please bear with me if I'm asking stupid

Re: D for project in computational chemistry

2015-08-17 Thread John Colvin via Digitalmars-d
On Sunday, 16 August 2015 at 13:59:33 UTC, Idan Arye wrote: Initially I thought the Python version is so slow because it uses `range` instead of `xrange`, but I tried them both and they both take about the same, so I guess the Python JIT(or even interpreter!) can optimize these allocations

Re: Release D 2.068.0

2015-08-12 Thread John Colvin via Digitalmars-d-announce
On Wednesday, 12 August 2015 at 02:46:41 UTC, Ben Boeckel wrote: On Tue, Aug 11, 2015 at 22:36:47 +, John Colvin via Digitalmars-d-announce wrote: Not true. AFAIK /usr/local is the only bit of /usr that *is* available for third-parties. Ah, mixed it up with this tidbit: The /usr

Re: countUntil for SortedRange

2015-08-11 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 11 August 2015 at 19:30:02 UTC, Laeeth Isharc wrote: Hi. Basic question: suppose I have a SortedRange and want to find the index of the first entry of an array of structs matching a needle struct. What's the best way to do that? It's not clear that countUntil treats a

Re: Release D 2.068.0

2015-08-11 Thread John Colvin via Digitalmars-d-announce
On Tuesday, 11 August 2015 at 22:08:50 UTC, Bill Baxter wrote: On Tue, Aug 11, 2015 at 12:52 AM, John Colvin via Digitalmars-d-announce digitalmars-d-announce@puremagic.com wrote: On Monday, 10 August 2015 at 08:48:52 UTC, Martin Nowak wrote: Glad to announce D 2.068.0. http

Re: Release D 2.068.0

2015-08-11 Thread John Colvin via Digitalmars-d-announce
On Tuesday, 11 August 2015 at 22:30:04 UTC, Ben Boeckel wrote: On Tue, Aug 11, 2015 at 15:08:21 -0700, Bill Baxter via Digitalmars-d-announce wrote: New to brew... getting errors with this on Yosemite: Error: Permission denied - /usr/local/etc/dmd.conf and sudo brew install refuses to do

Re: Where the F*** is phobos on OSX nowadays ?

2015-08-11 Thread John Colvin via Digitalmars-d
On Tuesday, 11 August 2015 at 04:51:03 UTC, deadalnix wrote: And why does it keep moving ? Why isn't it in some place where linker will find it ? Is that really worth it to have every build system to have to jump through hoops to find it, and to break it on a regular basis ? well if you're

Re: Release D 2.068.0

2015-08-11 Thread John Colvin via Digitalmars-d-announce
On Tuesday, 11 August 2015 at 08:27:00 UTC, Marc Schütz wrote: Packages for openSUSE 13.1, 13.2, Factory and Tumbleweed are now available in devel:languages:D. http://download.opensuse.org/repositories/devel:/languages:/D/ Please could you update/correct the entry here to reflect that:

Re: Suggestion: arrays.

2015-08-11 Thread John Colvin via Digitalmars-d
On Tuesday, 11 August 2015 at 08:59:50 UTC, DLearner wrote: From dlang: Static array properties are: ... .dup Create a dynamic array of the same size and copy the contents of the array into it. .idup Create a dynamic array of the same size and copy the contents of the array into it. The

Re: Release D 2.068.0

2015-08-11 Thread John Colvin via Digitalmars-d-announce
On Monday, 10 August 2015 at 08:48:52 UTC, Martin Nowak wrote: Glad to announce D 2.068.0. http://downloads.dlang.org/releases/2.x/2.068.0/ This release comes with many rangified phobos functions, 2 new GC profilers, a new AA implementation, and countless further improvements and fixes.

Re: Where the F*** is phobos on OSX nowadays ?

2015-08-11 Thread John Colvin via Digitalmars-d
On Tuesday, 11 August 2015 at 16:12:12 UTC, Sebastiaan Koppe wrote: On Tuesday, 11 August 2015 at 08:01:53 UTC, John Colvin wrote: On Tuesday, 11 August 2015 at 04:51:03 UTC, deadalnix wrote: And why does it keep moving ? Why isn't it in some place where linker will find it ? Is that really

Re: D for Game Development

2015-08-10 Thread John Colvin via Digitalmars-d
On Sunday, 9 August 2015 at 05:31:41 UTC, Walter Bright wrote: I agree, and now we ship a Phobos DLL, resolving that issue. I think most people these days associate DLL exclusively with windows. I certainly do.

Re: Proposal : mnemonic for start index for slices

2015-08-08 Thread John Colvin via Digitalmars-d
On Saturday, 8 August 2015 at 13:08:08 UTC, Temtaime wrote: Hi ! I want to add some sugar to D : sometimes it's necessary to use complex start index. For example: auto sub = arr[idx + 123 * 10..idx + 123 * 10 + 1]; Proposal is to add a mnemonic for start index, for instance : auto sub =

Re: D for project in computational chemistry

2015-08-06 Thread John Colvin via Digitalmars-d
On Thursday, 6 August 2015 at 08:11:49 UTC, Gerald Jansen wrote: On Wednesday, 5 August 2015 at 18:49:21 UTC, bachmeier wrote: Yes. The question is whether we can put together a group of developers to build the infrastructure, which is a lot more than just code. That means, in particular,

Re: Find on sorted range slower?

2015-08-06 Thread John Colvin via Digitalmars-d-learn
On Friday, 7 August 2015 at 00:35:58 UTC, Tofu Ninja wrote: void main() { auto a = new int[100*1024*1024]; for(int i = 0; i 100*1024*1024; i++) { a[i] = i; } enum f = 100*1024*1000; StopWatch sw; {

Re: Creating a Priority Queue: An Adventure

2015-08-06 Thread John Colvin via Digitalmars-d-learn
On Thursday, 6 August 2015 at 08:44:17 UTC, Per Nordlöw wrote: On Wednesday, 5 August 2015 at 18:20:41 UTC, John Colvin wrote: [...] I suggest you rehearse on how a binary heap works. A binary heap with array storage trades speed for memory compactness, a bit similar to how quick sort

Re: D for Game Development

2015-08-05 Thread John Colvin via Digitalmars-d
On Tuesday, 4 August 2015 at 19:14:51 UTC, Rick wrote: Unfortunately I'm regrettably having to reconsider my decision to start a game project (or any project requiring significant time investment) in D. Not because of the language or compiler, but rather because of the lack maturity in the

Re: D for Game Development

2015-08-05 Thread John Colvin via Digitalmars-d
On Wednesday, 5 August 2015 at 15:08:46 UTC, Rick wrote: On Wednesday, 5 August 2015 at 09:03:47 UTC, John Colvin wrote: On Tuesday, 4 August 2015 at 19:14:51 UTC, Rick wrote: Unfortunately I'm regrettably having to reconsider my decision to start a game project (or any project requiring

Re: Creating a Priority Queue: An Adventure

2015-08-05 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 5 August 2015 at 11:09:29 UTC, Per Nordlöw wrote: On Wednesday, 5 August 2015 at 09:04:54 UTC, Nordlöw wrote: This will however duplicate the underlying array aswell, which is probably not what we want. How do we avoid this? Correction: the underlying storage array *must* be

Re: Creating a Priority Queue: An Adventure

2015-08-05 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 5 August 2015 at 15:29:39 UTC, Nordlöw wrote: On Wednesday, 5 August 2015 at 13:37:19 UTC, John Colvin wrote: On Wednesday, 5 August 2015 at 11:09:29 UTC, Per Nordlöw wrote: On Wednesday, 5 August 2015 at 09:04:54 UTC, Nordlöw wrote: This will however duplicate the underlying

Re: Concurrency Confusion

2015-08-04 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 4 August 2015 at 08:03:54 UTC, 岩倉 澪 wrote: Hi all, I'm a bit confused today (as usual, haha). I have a pointer to a struct (let's call it Foo) allocated via a C library. I need to do some expensive computation with the Foo* to create a Bar[], but I would like to do that

Re: D for project in computational chemistry

2015-08-04 Thread John Colvin via Digitalmars-d
On Tuesday, 4 August 2015 at 13:42:15 UTC, Chris wrote: On Tuesday, 4 August 2015 at 13:25:22 UTC, maarten van damme wrote: I'm not a programmer myself and used D for a project in computational electromagnetics. While I had to implement numerical integration and a bit of linear algebra which

Re: DUB linking to local library

2015-08-04 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 4 August 2015 at 03:20:38 UTC, Craig Dillabaugh wrote: I can now run it with: LD_LIBRARY_PATH=/home/craig2/code/gdal-2.0.0/lib64 ./gdaltest But it appears the LD_LIBRARY_PATH hack is causing havoc with other libraries, as I get errors loading other shared libraries when I do

Re: assert(0) behavior

2015-08-04 Thread John Colvin via Digitalmars-d
On Tuesday, 4 August 2015 at 22:06:06 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 4 August 2015 at 20:21:24 UTC, Walter Bright wrote: On 8/3/2015 8:37 PM, Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= ola.fosheim.grostad+dl...@gmail.com wrote: The input/environment/code distinction does not work very

Re: D for project in computational chemistry

2015-08-04 Thread John Colvin via Digitalmars-d
On Tuesday, 4 August 2015 at 20:37:18 UTC, bachmeier wrote: A couple of things that might make D more pleasant for me are: - I do a lot of simulation-related things, where the inputs and outputs can change a lot as I figure out how I want to do things, and - I use R. R was invented down the

Re: D for project in computational chemistry

2015-08-04 Thread John Colvin via Digitalmars-d
On Tuesday, 4 August 2015 at 18:56:20 UTC, jmh530 wrote: On Tuesday, 4 August 2015 at 09:48:07 UTC, Chris wrote: I agree with bachmeier. You cannot go wrong. You mentioned nested loops. D allows you to concatenate (or pipe) loops. So instead of foreach { foreach { foreach { }

Re: Calling Syntax (no, not UFCS)

2015-08-03 Thread John Colvin via Digitalmars-d-learn
On Monday, 3 August 2015 at 22:42:15 UTC, SirNickolas wrote: Hello! I'm new in D and it is amazing! Can you tell me please if it is discouraged or deprecated to call a function by just putting its name, without brackets? It's quite unusual for me (used C++ and Python before), but I can see

Re: Why Java (server VM) is faster than D?

2015-08-03 Thread John Colvin via Digitalmars-d
On Monday, 3 August 2015 at 16:27:39 UTC, aki wrote: When I was trying to port some Java program to D, I noticed Java is faster than D. I made a simple bench mark test as follows. Then, I was shocked with the result. test results on Win8 64bit (smaller is better) Java(1.8.0,64bit,server): 0.677

Re: Why Java (server VM) is faster than D?

2015-08-03 Thread John Colvin via Digitalmars-d
On Monday, 3 August 2015 at 16:47:14 UTC, Adam D. Ruppe wrote: You can try a few potential optimizations in the D version yourself and see if it makes a difference. Devirtualization has a very small impact. Test this by making `test` take `SubFoo` and making `bar` final, or making `bar` a

Re: Why Java (server VM) is faster than D?

2015-08-03 Thread John Colvin via Digitalmars-d
On Monday, 3 August 2015 at 16:53:30 UTC, Adam D. Ruppe wrote: On Monday, 3 August 2015 at 16:47:58 UTC, John Colvin wrote: gets me down to 0.182s with ldc on OS X Yeah, I tried dmd with the final and didn't get a difference but gdc with final (and -frelease, very important for max speed

Re: Why Java (server VM) is faster than D?

2015-08-03 Thread John Colvin via Digitalmars-d
On Monday, 3 August 2015 at 16:41:42 UTC, Steven Schveighoffer wrote: On 8/3/15 12:31 PM, Dmitry Olshansky wrote: On 03-Aug-2015 19:27, aki wrote: When I was trying to port some Java program to D, I noticed Java is faster than D. I made a simple bench mark test as follows. Then, I was shocked

Re: Why Java (server VM) is faster than D?

2015-08-03 Thread John Colvin via Digitalmars-d
On Monday, 3 August 2015 at 16:27:39 UTC, aki wrote: When I was trying to port some Java program to D, I noticed Java is faster than D. I made a simple bench mark test as follows. Then, I was shocked with the result. [...] What compilation flags?

Re: Beta D 2.068.0-b2

2015-08-02 Thread John Colvin via Digitalmars-d-announce
On Sunday, 2 August 2015 at 09:38:23 UTC, Martin Nowak wrote: On Thursday, 30 July 2015 at 09:24:09 UTC, John Colvin wrote: https://www.microsoft.com/en-us/download/details.aspx?id=46886 Does it include the C++ compiler and linker? I think it contains a linker, but I'm not 100% sure. See

Re: Array start index

2015-08-01 Thread John Colvin via Digitalmars-d-learn
On Saturday, 1 August 2015 at 09:35:53 UTC, DLearner wrote: Does the D language set in stone that the first element of an array _has_ to be index zero? For the builtin slice types? Yes, set in stone. Wouldn't starting array elements at one avoid the common 'off-by-one' logic error, it does

Re: SDLang-D v0.9.2

2015-08-01 Thread John Colvin via Digitalmars-d-announce
On Friday, 31 July 2015 at 15:52:09 UTC, Nick Sabalausky wrote: SDLang-D: A library to parse/generate SDL (Simple Data Language) files. Offers both DOM and StAX/Pull APIs. SDL is like XML/JSON/YAML, but is low-verbosity, simpler than YAML, and supports comments and basic datatypes. It looks

Re: Struct that destroys its original handle on copy-by-value

2015-08-01 Thread John Colvin via Digitalmars-d-learn
On Saturday, 1 August 2015 at 12:10:43 UTC, Joseph Rushton Wakeling wrote: On 31/07/15 19:21, Ali Çehreli via Digitalmars-d-learn wrote: On 07/26/2015 04:29 AM, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: is this design idea even feasible in principle, or just a bad idea from

Re: Working with pdf

2015-07-30 Thread John Colvin via Digitalmars-d
On Thursday, 30 July 2015 at 11:19:48 UTC, Kingsley wrote: Hi Can anyone recommend any ways of pdf creation using D. I am generating an HTML and JavaScript page but I would like it in pdf format as well. I don't know of any pdf handling libraries in D Definitely check first to see if a

Re: Beta D 2.068.0-b2

2015-07-30 Thread John Colvin via Digitalmars-d-announce
On Wednesday, 29 July 2015 at 18:13:22 UTC, Kagamin wrote: On Wednesday, 29 July 2015 at 15:45:19 UTC, Taylor Hillegeist wrote: I guess what I mean to say is that they did it, maybe it can be done. Of course it can be done with an additional license agreement with microsoft. Of course VS

Re: Read text file fast, how?

2015-07-27 Thread John Colvin via Digitalmars-d
On Monday, 27 July 2015 at 12:03:40 UTC, Johan Holmberg wrote: On Sun, Jul 26, 2015 at 5:36 PM, Andrei Alexandrescu via Digitalmars-d digitalmars-d@puremagic.com wrote: [...] Back on MacOS again, I thought I should try to run Instruments on my program. I'm not familiar with the DMD

Re: Yes or No Options

2015-07-27 Thread John Colvin via Digitalmars-d
On Monday, 27 July 2015 at 15:40:56 UTC, Alex wrote: Hey guys! I am super new to programming and still trying to learn the very basics via a book that I bought. [...] This isn't the right place for this sort of question, please use http://forum.dlang.org/group/learn, I'm sure someone will

Re: Can't Compile Global Semaphores?

2015-07-27 Thread John Colvin via Digitalmars-d-learn
On Monday, 27 July 2015 at 19:56:15 UTC, Steven Schveighoffer wrote: On 7/27/15 3:10 PM, Jack Stouffer wrote: Hi, I am currently working through a book on the fundamentals of computer concurrency and I wanted to do all of the exercises in D. But I ran into a problem when I tried to have a

Re: Getting this to work similar to self in Python

2015-07-23 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 22:52:22 UTC, John Colvin wrote: On Wednesday, 22 July 2015 at 22:22:02 UTC, nurfz wrote: [...] Fields of classes are not in any way polymorphic in D (this is the same as C++ and I think java too). Base class members can be accessed like so: class Vehicle {

Re: Thread pools

2015-07-22 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 15:51:23 UTC, Chris wrote: On Wednesday, 22 July 2015 at 15:41:06 UTC, Alex Parrill wrote: On Wednesday, 22 July 2015 at 14:28:48 UTC, Chris wrote: What would be the best way to manage different threads (spawned via std.concurrency), e.g. to tell them to stop at

Re: Stable partition3 implementation

2015-07-22 Thread John Colvin via Digitalmars-d
On Wednesday, 22 July 2015 at 16:59:29 UTC, Xinok wrote: On Saturday, 11 July 2015 at 02:56:55 UTC, Timon Gehr wrote: [...] I understand now. I had never heard of an iterated logarithm before. I took the asterisk to mean some constant, like a wild card if you will. Sorry for the confusion.

Re: Measuring Execution time

2015-07-22 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 09:23:36 UTC, Clayton wrote: How does one represent Duration in only Micro-seconds, or milliseconds. Trying to measure the execution time of an algorithm and I get 4 ms, 619 μs, and 8 hnsecs , I want to sum all these and get total hnsecs or μs . I would also

Re: Rant after trying Rust a bit

2015-07-22 Thread John Colvin via Digitalmars-d
On Wednesday, 22 July 2015 at 21:36:58 UTC, jmh530 wrote: On Wednesday, 22 July 2015 at 20:43:04 UTC, simendsjo wrote: When everything is an expressions, you can write things like auto a = if(e) c else d; In D you have to write type a = invalid_value; if(e) a = c; else a = d;

Re: Getting this to work similar to self in Python

2015-07-22 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 22:22:02 UTC, nurfz wrote: How could I get this D code to work similar to this Python code? So, here is the D code: import std.stdio; class Vehicle { int speed; void printSpeed() { writeln(this.speed); } }

Re: GLU in DerelictOrg

2015-07-21 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 12:26:30 UTC, Spacen Jasset wrote: It seems that Derelict3 contains GLUT whereas derelict2 containss GLU. It appears I need GLU but I am somewhat confused as to what the diffrence is. Whoops, yes you are right, my mistake. Isn't glu considered legacy these days?

Re: GLU in DerelictOrg

2015-07-21 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 11:08:13 UTC, Spacen Jasset wrote: Hello, Can anyone tell me if the GLU functions, gluSpehere etc are availble in DerelictOrg or have they been removed. I can replace these with my own versions, but was hoping to do a quick port to DerelictOrg They are not

Re: DUB RC 0.9.24-rc.1 ready for testing

2015-07-21 Thread John Colvin via Digitalmars-d
On Monday, 20 July 2015 at 23:18:34 UTC, Andrei Alexandrescu wrote: On 7/20/15 5:30 PM, Martin Nowak wrote: On Thursday, 16 July 2015 at 08:28:08 UTC, Suliman wrote: In what version of DMD do you plan to include dub and vibe? It doesn't make sense to include vibe.d. I think it does - this

Re: std.algorithm each documentation terse

2015-07-20 Thread John Colvin via Digitalmars-d-learn
On Monday, 20 July 2015 at 14:40:59 UTC, jmh530 wrote: I have found the documentation for each in std.algorithm a bit terse. It seemed like it was an eager version of map, but it seems to be a bit more limited than that. In particular, the documentation says that if you can mutate the value

Re: Trying to link to Qt 5 on dmd 2.068.0~beta1

2015-07-20 Thread John Colvin via Digitalmars-d
On Monday, 20 July 2015 at 16:03:03 UTC, Shriramana Sharma wrote: Trying to compile the attached program to test DMD 2.068's promised C++ interfacing capabilities: $ dmd qt.d -L-L/usr/share/x86_64-linux-gnu -L-lQt5Core -L-lQt5Gui qt.o:(.rodata+0x40): undefined reference to `QWidget::show()'

Re: Case study on ranges and lazy evaluation

2015-07-20 Thread John Colvin via Digitalmars-d-announce
On Monday, 20 July 2015 at 18:17:18 UTC, Adam D. Ruppe wrote: Quick, what does this loop in this function do? void PanelBar::RepositionExpandedPanels(Panel* fixed_panel) I'm willing to guess it repositions the expanded panels named functions are the best abstraction. That's great for

Re: Wait, what? What is AliasSeq?

2015-07-18 Thread John Colvin via Digitalmars-d
On Saturday, 18 July 2015 at 01:44:27 UTC, Jonathan M Davis wrote: On Saturday, 18 July 2015 at 01:32:45 UTC, Andrei Alexandrescu wrote: [...] _Please_ no. It'll just make it extra confusing whether you're talking about what was TypeTuple or just aliases in general. That's why I've never

<    2   3   4   5   6   7   8   9   10   11   >