Re: using std.algorithm to find intersection of DateTime[][] arg

2015-09-10 Thread Artem Tarasov via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 20:28:35 UTC, Laeeth Isharc wrote: so setIntersection(arg[0],arg[1],arg[2] .. arg[$-1]) except that I don't know how many series are in arg at compile time. what's the most efficient way to use Phobos to find these? (I could write a loop, but I am trying

Re: What is the std.stream replacement?

2015-07-20 Thread Artem Tarasov via Digitalmars-d-learn
On Monday, 20 July 2015 at 00:58:20 UTC, Charles Hixson wrote: I have DMD64 D Compiler v2.067.1 installed, and in the documentation of phobos what it says about std.stream is don't use it on new code. It doesn't, however, appear to offer any replacement. Certainly std.file, std.stdio, and

How to strip struct/class invariants?

2015-07-05 Thread Artem Tarasov via Digitalmars-d-learn
OK, so there was an old bug fixed in 2.067 (https://issues.dlang.org/show_bug.cgi?id=4421) so that now unions apparently can't contain a struct that has invariants. It kinda makes sense, although I don't see why the invariants can be simply ignored, as they don't have as much importance as

Re: How to strip struct/class invariants?

2015-07-05 Thread Artem Tarasov via Digitalmars-d-learn
On Sunday, 5 July 2015 at 14:44:30 UTC, John Colvin wrote: struct A { ubyte[B.sizeof] mem; @property ref B b() { return *cast(B*)(mem.ptr); } mixin std.typecons.Proxy!b; } Thanks, I followed your suggestion and effectively rolled out my own union implementation.

Re: What does dmd 2.066 want from me?

2015-01-08 Thread Artem Tarasov via Digitalmars-d-learn
On Thursday, 8 January 2015 at 01:22:54 UTC, Rikki Cattermole wrote: Have you got opEqual's defined? Its wanting that and toHash I think. Yes, I have opEquals defined. I've just tried to add dummy toHash (returning a constant), but it doesn't help :( OK, it seems I'll have to stick with

What does dmd 2.066 want from me?

2015-01-07 Thread Artem Tarasov via Digitalmars-d-learn
I'm trying to compile my software with the latest compiler, and it spits out the following error: $ make ... rdmd --force --build-only -IBioD -g -L-Lhtslib -L-l:libhts.a -L-l:libphobos2.a -ofbuild/sambamba.o main.d ...

Re: Segmentation fault after having a certain number of elements in an array?

2014-12-13 Thread Artem Tarasov via Digitalmars-d-learn
On Saturday, 13 December 2014 at 09:24:51 UTC, Paul wrote: You are testing i against an ever-increasing limit aren't you, so it's an infinite loop. Read more carefully. samples is unmodified, it's m_samples whose length is changed.

Re: Segmentation fault after having a certain number of elements in an array?

2014-12-13 Thread Artem Tarasov via Digitalmars-d-learn
On Saturday, 13 December 2014 at 08:59:19 UTC, Jeremy DeHaan wrote: I'll be trying to narrow it down even more tomorrow, but I was hoping somone here might have some insight into this weird issue I am having. Could you upload the code to somewhere? With only a small snippet, it's hard to get

printing array of strings with writefln?

2014-11-16 Thread Artem Tarasov via Digitalmars-d-learn
writefln(%(%s-%), [a, b, c]) doesn't print the intended a-b-c but surrounds each string with double quotes - a-b-c, which I find inconsistent with the fact that writefln(%s, a string) prints the string without any quotes. How do I get the desired behaviour using just the format string?

Re: printing array of strings with writefln?

2014-11-16 Thread Artem Tarasov via Digitalmars-d-learn
Thanks! The Ali's book is indeed superb, covering even such minor details.

Re: std.parallelism curious results

2014-10-05 Thread Artem Tarasov via Digitalmars-d-learn
Welcome to the world of multithreading. You have just discovered that atomic operations are performance killers, congratulations on this.

Re: Large binary size using std.regex

2014-08-24 Thread Artem Tarasov via Digitalmars-d-learn
On Sunday, 24 August 2014 at 03:14:33 UTC, ketmar via Digitalmars-d-learn wrote: yes. this binary includes statically linked runtime and phobos, plus alot of template expansions. alas, template magic is not free. OTOH, on Linux latest LDC does far better job in eliminating dead code than

Re: Large binary size using std.regex

2014-08-24 Thread Artem Tarasov via Digitalmars-d-learn
On Sunday, 24 August 2014 at 06:20:38 UTC, ketmar via Digitalmars-d-learn wrote: does ldc uses shared runtime here? No, it doesn't: $ ldd test linux-vdso.so.1 (0x7fffce266000) librt.so.1 = /usr/lib/librt.so.1 (0x7fc174193000) libdl.so.2 = /usr/lib/libdl.so.2

Re: Improving IO Speed

2014-03-15 Thread Artem Tarasov
Did you try setvbuf method of std.stdio.File?

Re: How to append to SortedRange?

2014-02-16 Thread Artem Tarasov
Use a container adequate for the task at hand, e.g. red-black tree.

Re: How to append to SortedRange?

2014-02-16 Thread Artem Tarasov
On Sunday, 16 February 2014 at 12:51:10 UTC, bearophile wrote: If you have a limited number of small values (like 30 ints) using a sorted array is quite efficient, and keeps low the binary size and the pressure on the code L1 cache :-) Yup, I admit I over-generalized. But this sorted array

Re: Circular Buffer

2014-02-13 Thread Artem Tarasov
On Thursday, 13 February 2014 at 20:56:32 UTC, Frustrated wrote: how efficient is ufcs? It seems like it would be very slow in general and way better to manually do the code. I wonder if anyone has done any tests? LDC and GDC are pretty darn good at inlining these UFCS chains, but the yielded

Re: Python calling D

2014-02-04 Thread Artem Tarasov
On Tuesday, 4 February 2014 at 11:33:40 UTC, Russel Winder wrote: The question is how to get this run. Pointing out obvious things, part 2: wrap it into a C function and call that function when loading the Python module. library.d: ... extern (C) export void attach() { Runtime.initialize();

Re: Python calling D

2014-02-03 Thread Artem Tarasov
On Sunday, 2 February 2014 at 15:31:30 UTC, Russel Winder wrote: result is: | LD_LIBRARY_PATH=. python execute.py Segmentation fault You should call Runtime.initialize() prior to calling any other D functions.