Re: Initialising multidimensional dynamic arrays

2014-10-01 Thread Mike James via Digitalmars-d-learn
On Tuesday, 30 September 2014 at 17:22:32 UTC, Steven Schveighoffer wrote: On 9/30/14 12:40 PM, Mike James wrote: On Tuesday, 30 September 2014 at 16:07:28 UTC, ketmar via Digitalmars-d-learn wrote: auto a = new int[][](42, 69); ... You'll notice that it's actually a dynamic array of

Re: Opening dub packages in Mono-D

2014-10-01 Thread Phil via Digitalmars-d-learn
mm... is your 'project' a dub package itself? if not, convert it to dub and add it to dependency section in your dub package. then you will be able to open your fresh created project using mono-d with all its dependencies, a bonus you will be able to generate visuald project files too.

Re: Initialising multidimensional dynamic arrays

2014-10-01 Thread Mike James via Digitalmars-d-learn
On Tuesday, 30 September 2014 at 15:57:58 UTC, Mike James wrote: Hi, How do I initialise a dynamic array of dynamic arrays? struct MyData { SysTime stamp; short[] data; this(size_t size) { data = new short[size]; } } MyDataArray mda; how to initialise mda? mda = new MyDataArray

Re: Initialising multidimensional dynamic arrays

2014-10-01 Thread ketmar via Digitalmars-d-learn
On Wed, 01 Oct 2014 07:45:48 + Mike James via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: so in the constructor... this(size_t x, size_t y) { mda = new MyDataArray[](x); foreach(n, _; mda) mda[n].data.length = y; } Is there a simpler way? sorry, but no.

Re: Initialising multidimensional dynamic arrays

2014-10-01 Thread Mike James via Digitalmars-d-learn
On Wednesday, 1 October 2014 at 08:08:06 UTC, ketmar via Digitalmars-d-learn wrote: On Wed, 01 Oct 2014 07:45:48 + Mike James via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: so in the constructor... this(size_t x, size_t y) { mda = new MyDataArray[](x);

Find Semantically Correct Word Splits in UTF-8 Strings

2014-10-01 Thread Nordlöw
I'm looking for a way to make my algorithm S[] findWordSplit(S)(S word, HLang[] langs = []) { for (size_t i = 1; i + 1 word.length; i++) { const first = word[0..i]; const second = word[i..$]; if

Re: Find Semantically Correct Word Splits in UTF-8 Strings

2014-10-01 Thread Nordlöw
On Wednesday, 1 October 2014 at 11:06:24 UTC, Nordlöw wrote: I'm looking for a way to make my algorithm Update: S[] findMeaningfulWordSplit(S)(S word, HLang[] langs = []) if (isSomeString!S) { for (size_t i = 1; i + 1 word.length; i++)

Re: Find Semantically Correct Word Splits in UTF-8 Strings

2014-10-01 Thread Nordlöw
On Wednesday, 1 October 2014 at 11:47:41 UTC, Nordlöw wrote: Do we need a new InputRange algorithm for this? If so, how about naming it SlidingSplitter or perhaps SlidingHalver in the binary case? I haven't thought about making this variadic on the number of splits (= 1) but that could be

Re: Initialising multidimensional dynamic arrays

2014-10-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/1/14 3:13 AM, Mike James wrote: Hi Steve, It's true that his code initialises an array of arrays - but my array is an array of structs containing a dynamic array. Regards, -=mike=- Ah, ok. There is no trivial way to do it. Unlike C++, struct default ctors cannot be overridden. I

Re: Find Semantically Correct Word Splits in UTF-8 Strings

2014-10-01 Thread Kagamin via Digitalmars-d-learn
S[] findMeaningfulWordSplit(S)(S word, HLang[] langs = []) if (isSomeString!S) { S second = word; for (size_t i = 1; i + 1 word.length; i++) { second = second.dropExactly(i).to!string; const first =

Re: Find Semantically Correct Word Splits in UTF-8 Strings

2014-10-01 Thread monarch_dodra via Digitalmars-d-learn
On Wednesday, 1 October 2014 at 11:47:41 UTC, Nordlöw wrote: On Wednesday, 1 October 2014 at 11:06:24 UTC, Nordlöw wrote: I'm looking for a way to make my algorithm Update: S[] findMeaningfulWordSplit(S)(S word, HLang[] langs = []) if (isSomeString!S)

Re: Find Semantically Correct Word Splits in UTF-8 Strings

2014-10-01 Thread monarch_dodra via Digitalmars-d-learn
On Wednesday, 1 October 2014 at 11:06:24 UTC, Nordlöw wrote: I'm looking for a way to make my algorithm S[] findWordSplit(S)(S word, HLang[] langs = []) { for (size_t i = 1; i + 1 word.length; i++) { const first = word[0..i];

Re: Find Semantically Correct Word Splits in UTF-8 Strings

2014-10-01 Thread Nordlöw
On Wednesday, 1 October 2014 at 16:44:24 UTC, monarch_dodra wrote: language? If you avoid decoding in your canMeanSomething, you should encounter no problems. You're right. I'll try that.

cgi.d - fastcgi - how am i suppose to link in libfcgi.a or libfcgi.lib

2014-10-01 Thread Sycam_Inc via Digitalmars-d-learn
im truing to use the fastcgi support provided by cgi.d found at https://github.com/adamdruppe/arsd/blob/master/cgi.d with the -version fastcgi flag on the compiler. however its creator said it requires the fastcgi C lib reviously, it spoke regular CGI, FastCGI (with help from a C lib) and HTTP

Re: cgi.d - fastcgi - how am i suppose to link in libfcgi.a or libfcgi.lib

2014-10-01 Thread Adam D. Ruppe via Digitalmars-d-learn
Try linking in these .obj files that I compiled for windows a while ago: http://arsdnet.net/dcode/fcgi_win.zip so unzip that, put it in your project directory and just add both .obj files to your compile command line along with -version=fastcgi. It has been a LONG time since I used that,

Re: Find Semantically Correct Word Splits in UTF-8 Strings

2014-10-01 Thread monarch_dodra via Digitalmars-d-learn
On Wednesday, 1 October 2014 at 11:47:41 UTC, Nordlöw wrote: On Wednesday, 1 October 2014 at 11:06:24 UTC, Nordlöw wrote: I'm looking for a way to make my algorithm Update: S[] findMeaningfulWordSplit(S)(S word, HLang[] langs = []) if (isSomeString!S)

Re: cgi.d - fastcgi - how am i suppose to link in libfcgi.a or libfcgi.lib

2014-10-01 Thread Sycam_Inc via Digitalmars-d-learn
On Wednesday, 1 October 2014 at 17:09:06 UTC, Adam D. Ruppe wrote: Try linking in these .obj files that I compiled for windows a while ago: http://arsdnet.net/dcode/fcgi_win.zip so unzip that, put it in your project directory and just add both .obj files to your compile command line along

Re: Find Semantically Correct Word Splits in UTF-8 Strings

2014-10-01 Thread Nordlöw
On Wednesday, 1 October 2014 at 17:09:57 UTC, monarch_dodra wrote: Does that even work? takeExactly would pop up to N *codepoints*, whereas your string only has N *codeunits*. Your're right again :) If forgot that takeExactly auto-decodes.

A hash table implementation benchmark

2014-10-01 Thread Ali Çehreli via Digitalmars-d-learn
Found on Reddit: http://lonewolfer.wordpress.com/2014/03/13/benchmarking-hash-table-implementations-in-different-languages/ Are you motivated enough to compare D's associative arrays with those results? :) Ali

Re: How do you get T from shared(T) ?

2014-10-01 Thread Marco Leise via Digitalmars-d-learn
Am Tue, 30 Sep 2014 14:48:03 + schrieb John Colvin john.loughran.col...@gmail.com: On Sunday, 28 September 2014 at 09:11:07 UTC, Marco Leise wrote: For head-unshared there is `static if (is(T U : shared U))`. But how do you get the unshared type for anything from `shared void*` to

Re: A hash table implementation benchmark

2014-10-01 Thread Marco Leise via Digitalmars-d-learn
Am Wed, 01 Oct 2014 14:40:01 -0700 schrieb Ali Çehreli acehr...@yahoo.com: Found on Reddit: http://lonewolfer.wordpress.com/2014/03/13/benchmarking-hash-table-implementations-in-different-languages/ Are you motivated enough to compare D's associative arrays with those results? :)

Re: A hash table implementation benchmark

2014-10-01 Thread Marco Leise via Digitalmars-d-learn
Oh wit! It is a read-only benchmark.

Re: A hash table implementation benchmark

2014-10-01 Thread bearophile via Digitalmars-d-learn
Ali Çehreli: Found on Reddit: Where's the Reddit thread? Are you motivated enough to compare D's associative arrays with those results? :) D associative arrays are often even slower than CPython ones, so I don't expect D to shine in this comparison. This is a D port of the Java code,

Re: A significant performance difference

2014-10-01 Thread Martin Nowak via Digitalmars-d-learn
You're comparing front removal on an ordered vs. an unordered container. Anyhow at least my C++ lib also caches the first used bucket.

Re: A hash table implementation benchmark

2014-10-01 Thread Ali Çehreli via Digitalmars-d-learn
On 10/01/2014 03:32 PM, bearophile wrote: Ali Çehreli: Found on Reddit: Where's the Reddit thread? There was just a single comment on it so I didn't think it was important: http://www.reddit.com/r/programming/comments/2hzur4/benchmarking_hash_table_implementations_in/ D associative

Re: A hash table implementation benchmark

2014-10-01 Thread bearophile via Digitalmars-d-learn
Ali Çehreli: Never mind then. Well, now the D code is present, so why don't you benchmark it (but I don't know how much correct it is)? :-) Bye, bearophile

Re: A hash table implementation benchmark

2014-10-01 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 1 October 2014 at 21:40:01 UTC, Ali Çehreli wrote: Are you motivated enough to compare D's associative arrays with those results? :) Here's another benchmark: D AAs vs. Vibe.d's open addressing hashes vs. Robin Hood hashing: