Re: Mobile App STACK4 with a D backend

2013-12-24 Thread extrawurst
On Sunday, 22 December 2013 at 19:48:03 UTC, John Colvin wrote: On Sunday, 22 December 2013 at 13:38:22 UTC, extrawurst wrote: Hello fellow Dlers ;) about a week ago I released the multiplayer version of my android app STACK4

Re: Mobile App STACK4 with a D backend

2013-12-24 Thread John Colvin
On Tuesday, 24 December 2013 at 10:44:56 UTC, extrawurst wrote: On Sunday, 22 December 2013 at 19:48:03 UTC, John Colvin wrote: On Sunday, 22 December 2013 at 13:38:22 UTC, extrawurst wrote: Hello fellow Dlers ;) about a week ago I released the multiplayer version of my android app STACK4

Re: Mobile App STACK4 with a D backend

2013-12-24 Thread angel
I used this device (with Android): http://utilite-computer.com/web/home However, I believe any Android device with a USB plug might serve the task.

Re: Mobile App STACK4 with a D backend

2013-12-24 Thread Martin Krejcirik
On 22.12.2013 14:38, extrawurst wrote: would ask everyone who has access to an android device to test the app and give me feedback about every kind of problem you may encounter! Doesn't work for me on Xperia L. Stuck on black screen with small purple logo in the top left corner. -- mk

Natural Word Length

2013-12-24 Thread Mike
Is there a type in D that represents is always the unsigned natural word of the platform?

Re: Natural Word Length

2013-12-24 Thread Jakob Ovrum
On Tuesday, 24 December 2013 at 08:57:43 UTC, Mike wrote: Is there a type in D that represents is always the unsigned natural word of the platform? Yes, use the type `size_t`. It is an alias defined in object.d, which is a module part of druntime that is implicitly/automatically imported in

Re: DIP54 : revamp of Phobos tuple types

2013-12-24 Thread Philippe Sigaud
On Mon, Dec 23, 2013 at 7:34 PM, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: I'm waiting to see what others who use TypeTuples think of the DIP. E.g. Philippe Sigaud, David Nadlinger, Hara Kenji, Martin Nowak, Don Clugston, David Simcha, Steven Schveighoffer, etc. I'm pretty sure (most)

Re: DIP54 : revamp of Phobos tuple types

2013-12-24 Thread Dmitry Olshansky
24-Dec-2013 04:57, bearophile пишет: Andrei Alexandrescu: It often does make code shorter. It also avoids the programmer to think about useless details, leaving more brain for more important things. Assigning the fields to variables like this: const uselessTmp = foo(); immutable something =

Re: GtkD, DMD, GDC and LDC2

2013-12-24 Thread Kagamin
On Monday, 23 December 2013 at 16:04:00 UTC, Russel Winder wrote: -o- is not something I would ever think of as an option to any GCC-based compiler, perhaps I am missing something :-) Isn't this option borrowed from gcc?

Re: DIP54 : revamp of Phobos tuple types

2013-12-24 Thread Dmitry Olshansky
24-Dec-2013 09:00, Jakob Ovrum пишет: On Tuesday, 24 December 2013 at 04:48:57 UTC, Jakob Ovrum wrote: [1] Assuming that the case for non-auto-expanding lists can be argued sufficiently for inclusion in Phobos, which is yet to be seen. This DIP doesn't seem to even try. Clarification:

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Francesco Cattoglio
Thank you everyone for the feedback. I made the wrong assumption about phobos design, I didn't knew that the policy here is when needed, relax the range, and now I see it makes perfect sense. The range will only be a RA range for types that implement (inc * n) and ((end - begin) / step) (used

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread bearophile
Francesco Cattoglio: I agree. After relaxing the range, we can prefer a specialized version over the iota(begin, end, 1) version. The latter should be used as a backup instead for cases where ++ is not implemented. One possible disadvantage is when you want an array of various iota (all of

Re: GtkD, DMD, GDC and LDC2

2013-12-24 Thread Russel Winder
On Tue, 2013-12-24 at 10:27 +, Kagamin wrote: On Monday, 23 December 2013 at 16:04:00 UTC, Russel Winder wrote: -o- is not something I would ever think of as an option to any GCC-based compiler, perhaps I am missing something :-) Isn't this option borrowed from gcc? I think that is

Re: DIP54 : revamp of Phobos tuple types

2013-12-24 Thread Jakob Ovrum
On Tuesday, 24 December 2013 at 10:30:47 UTC, Dmitry Olshansky wrote: As long as algorithms that operate say on 2 lists expect arguments to have '.expand' we'd be in a good shape just providing a `packList` or some such together with `list`. I think so too. Of course, it is predicated on the

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Jakob Ovrum
On Tuesday, 24 December 2013 at 10:38:17 UTC, Francesco Cattoglio wrote: The range will only be a RA range for types that implement (inc * n) and ((end - begin) / step) (used for lenght computation), otherwise it will be a ForwardRange, because it can't be directional if we can't compute the

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Francesco Cattoglio
On Tuesday, 24 December 2013 at 11:05:05 UTC, Jakob Ovrum wrote: On Tuesday, 24 December 2013 at 10:38:17 UTC, Francesco Cattoglio wrote: The range will only be a RA range for types that implement (inc * n) and ((end - begin) / step) (used for lenght computation), otherwise it will be a

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread monarch_dodra
On Tuesday, 24 December 2013 at 11:05:05 UTC, Jakob Ovrum wrote: On Tuesday, 24 December 2013 at 10:38:17 UTC, Francesco Cattoglio wrote: The range will only be a RA range for types that implement (inc * n) and ((end - begin) / step) (used for lenght computation), otherwise it will be a

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Francesco Cattoglio
On Tuesday, 24 December 2013 at 10:44:54 UTC, bearophile wrote: Francesco Cattoglio: One possible disadvantage is when you want an array of various iota (all of the same indexed type, like int) (currently this doesn't compile), this was a potential use case for me: void main() { import

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Jakob Ovrum
On Tuesday, 24 December 2013 at 11:25:04 UTC, Francesco Cattoglio wrote: There's a catch: if we want bidirectional, we need the last element of the range. `end` is a parameter to all overloads of `iota`. Note that it is exclusive, so the first `back` is `--end`, not `end` as passed in by the

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Francesco Cattoglio
On Tuesday, 24 December 2013 at 11:30:32 UTC, Jakob Ovrum wrote: On Tuesday, 24 December 2013 at 11:25:04 UTC, Francesco Cattoglio wrote: There's a catch: if we want bidirectional, we need the last element of the range. Are you sure you understand bidirectional ranges correctly? Any range that

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Jakob Ovrum
On Tuesday, 24 December 2013 at 11:47:12 UTC, Francesco Cattoglio wrote: Correct, but there's no way to compute back with less than O(n) complexity, unless division by increment is available. (Actually, I think we can achieve O(log n) with multiplication alone, but I think it might be lots of

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Francesco Cattoglio
On Tuesday, 24 December 2013 at 11:47:12 UTC, Francesco Cattoglio wrote: Correct, but there's no way to compute back with less than O(n) complexity, unless division by increment is available. I would like to add that I want to compute back because the current documentation states: Returns a

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Joseph Rushton Wakeling
On 24/12/13 11:38, Francesco Cattoglio wrote: Ah, nice. There's an unstated assumption here - adding inc n times is the same as adding n * inc. Right, completely missed that. I guess checking a few test cases at compile time is the best one can do. Checking for every n could take some infinite

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread monarch_dodra
On Tuesday, 24 December 2013 at 11:57:04 UTC, Jakob Ovrum wrote: On Tuesday, 24 December 2013 at 11:47:12 UTC, Francesco Cattoglio wrote: Correct, but there's no way to compute back with less than O(n) complexity, unless division by increment is available. (Actually, I think we can achieve

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Joseph Rushton Wakeling
On 24/12/13 12:57, Jakob Ovrum wrote: Implement `back` is really trivial. Simplified example: --- auto iota(T)(T start, T end) { static struct Result { T start, end; bool empty() @property { return start == end; } T front() @property { return start; }

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Joseph Rushton Wakeling
On 24/12/13 13:58, monarch_dodra wrote: I think you are missing the point of what happens if the step is not 1 (or if the passed in type can have fractional input). EG: iota(0, 105, 10); or iota(0, 10.5); In this case, back should be 100, and not 95. To compute back, you need to be able to

Re: [RFC] ∅MQD, a ∅MQ wrapper for D

2013-12-24 Thread Lars T. Kyllingstad
On Monday, 23 December 2013 at 23:28:19 UTC, Rikki Guy wrote: Brilliant! I've found myself in need of this exactly, and had just started on my own - you have saved me a lot of work! Glad to be of assistance. :) If you run into any problems with the library, please report them here:

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread H. S. Teoh
On Tue, Dec 24, 2013 at 11:57:03AM +, Jakob Ovrum wrote: On Tuesday, 24 December 2013 at 11:47:12 UTC, Francesco Cattoglio wrote: Correct, but there's no way to compute back with less than O(n) complexity, unless division by increment is available. (Actually, I think we can achieve O(log

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Joseph Rushton Wakeling
On 24/12/13 16:39, H. S. Teoh wrote: This code is wrong for iota(1.0, 9.5), because .back must be of the form start + n*step for some integer n, but in this case end is not an integral multiple of step away from start. (It's not only wrong for .back, it also won't terminate because start==end

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Andrei Alexandrescu
On 12/24/13 3:57 AM, Jakob Ovrum wrote: bool empty() @property { return start == end; } This is better start = end if ordering comparisons are supported. Andrei

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Andrei Alexandrescu
On 12/24/13 5:09 AM, Joseph Rushton Wakeling wrote: On 24/12/13 13:58, monarch_dodra wrote: I think you are missing the point of what happens if the step is not 1 (or if the passed in type can have fractional input). EG: iota(0, 105, 10); or iota(0, 10.5); In this case, back should be 100,

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread H. S. Teoh
On Tue, Dec 24, 2013 at 09:10:53AM -0800, Andrei Alexandrescu wrote: On 12/24/13 5:09 AM, Joseph Rushton Wakeling wrote: On 24/12/13 13:58, monarch_dodra wrote: I think you are missing the point of what happens if the step is not 1 (or if the passed in type can have fractional input). EG:

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread H. S. Teoh
On Tue, Dec 24, 2013 at 09:27:54AM -0800, H. S. Teoh wrote: On Tue, Dec 24, 2013 at 09:10:53AM -0800, Andrei Alexandrescu wrote: On 12/24/13 5:09 AM, Joseph Rushton Wakeling wrote: On 24/12/13 13:58, monarch_dodra wrote: I think you are missing the point of what happens if the step is not

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Craig Dillabaugh
On Tuesday, 24 December 2013 at 18:56:02 UTC, Craig Dillabaugh wrote: On Tuesday, 24 December 2013 at 17:10:53 UTC, Andrei Alexandrescu wrote: On 12/24/13 5:09 AM, Joseph Rushton Wakeling wrote: clip Doesn't think work, or am I missing something? low + floor( (up-low)/step ) * step I

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Craig Dillabaugh
On Tuesday, 24 December 2013 at 17:10:53 UTC, Andrei Alexandrescu wrote: On 12/24/13 5:09 AM, Joseph Rushton Wakeling wrote: On 24/12/13 13:58, monarch_dodra wrote: I think you are missing the point of what happens if the step is not 1 (or if the passed in type can have fractional input). EG:

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread H. S. Teoh
On Tue, Dec 24, 2013 at 06:57:50PM +, Craig Dillabaugh wrote: On Tuesday, 24 December 2013 at 18:56:02 UTC, Craig Dillabaugh wrote: On Tuesday, 24 December 2013 at 17:10:53 UTC, Andrei Alexandrescu wrote: On 12/24/13 5:09 AM, Joseph Rushton Wakeling wrote: clip Doesn't think work, or

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Craig Dillabaugh
On Tuesday, 24 December 2013 at 19:08:40 UTC, H. S. Teoh wrote: On Tue, Dec 24, 2013 at 06:57:50PM +, Craig Dillabaugh wrote: On Tuesday, 24 December 2013 at 18:56:02 UTC, Craig Dillabaugh wrote: On Tuesday, 24 December 2013 at 17:10:53 UTC, Andrei Alexandrescu wrote: On 12/24/13 5:09 AM,

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Andrei Alexandrescu
On 12/24/13 10:56 AM, Craig Dillabaugh wrote: On Tuesday, 24 December 2013 at 17:10:53 UTC, Andrei Alexandrescu wrote: On 12/24/13 5:09 AM, Joseph Rushton Wakeling wrote: On 24/12/13 13:58, monarch_dodra wrote: I think you are missing the point of what happens if the step is not 1 (or if the

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Andrei Alexandrescu
On 12/24/13 11:17 AM, Craig Dillabaugh wrote: On Tuesday, 24 December 2013 at 19:08:40 UTC, H. S. Teoh wrote: On Tue, Dec 24, 2013 at 06:57:50PM +, Craig Dillabaugh wrote: On Tuesday, 24 December 2013 at 18:56:02 UTC, Craig Dillabaugh wrote: On Tuesday, 24 December 2013 at 17:10:53 UTC,

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread H. S. Teoh
On Tue, Dec 24, 2013 at 11:35:49AM -0800, Andrei Alexandrescu wrote: On 12/24/13 10:56 AM, Craig Dillabaugh wrote: On Tuesday, 24 December 2013 at 17:10:53 UTC, Andrei Alexandrescu wrote: [.[..] The integral cases are easy. We need to crack the floating point case: given numbers low, up, and

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Andrei Alexandrescu
On 12/24/13 11:59 AM, H. S. Teoh wrote: On Tue, Dec 24, 2013 at 11:35:49AM -0800, Andrei Alexandrescu wrote: On 12/24/13 10:56 AM, Craig Dillabaugh wrote: On Tuesday, 24 December 2013 at 17:10:53 UTC, Andrei Alexandrescu wrote: [.[..] The integral cases are easy. We need to crack the

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread H. S. Teoh
On Tue, Dec 24, 2013 at 12:57:02PM -0800, Andrei Alexandrescu wrote: On 12/24/13 11:59 AM, H. S. Teoh wrote: On Tue, Dec 24, 2013 at 11:35:49AM -0800, Andrei Alexandrescu wrote: On 12/24/13 10:56 AM, Craig Dillabaugh wrote: On Tuesday, 24 December 2013 at 17:10:53 UTC, Andrei Alexandrescu

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Andrei Alexandrescu
On 12/24/13 1:09 PM, H. S. Teoh wrote: On Tue, Dec 24, 2013 at 12:57:02PM -0800, Andrei Alexandrescu wrote: On 12/24/13 11:59 AM, H. S. Teoh wrote: On Tue, Dec 24, 2013 at 11:35:49AM -0800, Andrei Alexandrescu wrote: On 12/24/13 10:56 AM, Craig Dillabaugh wrote: On Tuesday, 24 December 2013

Reserving/Preallocating associative array?

2013-12-24 Thread Gordon
Hello, I want to load a large text file containing two numeric fields into an associative array. The file looks like: 1 40 4 2 42 11 ... And has 11M lines. My code looks like this: === void main() { size_t[size_t] unions; auto f = File(input.txt);

Re: Reserving/Preallocating associative array?

2013-12-24 Thread bearophile
Gordon: void main() { size_t[size_t] unions; auto f = File(input.txt); foreach ( line ; f.byLine() ) { auto fields = line.split(); size_t i = to!size_t(fields[0]); size_t j = to!size_t(fields[1]); unions[i]

Re: Reserving/Preallocating associative array?

2013-12-24 Thread bearophile
Gordon: The file looks like: 1 40 4 2 42 11 ... And has 11M lines. What's the interval of the numbers of the first column? Bye, bearophile

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread H. S. Teoh
On Tue, Dec 24, 2013 at 01:18:34PM -0800, Andrei Alexandrescu wrote: On 12/24/13 1:09 PM, H. S. Teoh wrote: On Tue, Dec 24, 2013 at 12:57:02PM -0800, Andrei Alexandrescu wrote: On 12/24/13 11:59 AM, H. S. Teoh wrote: On Tue, Dec 24, 2013 at 11:35:49AM -0800, Andrei Alexandrescu wrote: On

Re: Reserving/Preallocating associative array?

2013-12-24 Thread bearophile
Some ides to speed up your code: - Try to use parse instead of split + to!size_t - Try to use byLineFast, in the attach here (the code is not mine): https://d.puremagic.com/issues/attachment.cgi?id=1305 - Try to disable the GC before the associative array creation and re-enable it when it's

Re: Reserving/Preallocating associative array?

2013-12-24 Thread Gordon
Hello Bearophine, On Tuesday, 24 December 2013 at 23:13:59 UTC, bearophile wrote: Some ides to speed up your code: - Try to use parse instead of split + to!size_t - Try to use byLineFast, in the attach here (the code is not mine): https://d.puremagic.com/issues/attachment.cgi?id=1305 - Try to

Re: Reserving/Preallocating associative array?

2013-12-24 Thread Andrei Alexandrescu
On 12/24/13 2:28 PM, Gordon wrote: Hello, I want to load a large text file containing two numeric fields into an associative array. The file looks like: 1 40 4 2 42 11 ... And has 11M lines. My code looks like this: === void main() { size_t[size_t] unions;

Re: std.range.iota enhancement: supporting more types (AKA issue 10762)

2013-12-24 Thread Andrei Alexandrescu
On 12/24/13 3:11 PM, H. S. Teoh wrote: You're missing my point. It's Christmas, let's be nice to one another :o). The only problem here is that I didn't explain my point enough, which fostered confusion. I'm not talking about popBack specifically here. I'm talking about the problem of

Re: D.git

2013-12-24 Thread Vladimir Panteleev
On Wednesday, 25 December 2013 at 02:59:46 UTC, Ali Çehreli wrote: I've been using the following repository to build the most recent dmd, druntime, and phobos: https://github.com/carlor/dlang-workspace Are they similar? Not quite, but perhaps you could use them together. I haven't

Re: D.git

2013-12-24 Thread Ali Çehreli
On 12/24/2013 06:19 PM, Vladimir Panteleev wrote: I wrote a tool which generates a git repository containing the D components as submodules: https://github.com/CyberShadow-D/D This repository has a linear history, and contains only updates to its submodules. The submodule updates are mainly

D.git

2013-12-24 Thread Vladimir Panteleev
I wrote a tool which generates a git repository containing the D components as submodules: https://github.com/CyberShadow-D/D This repository has a linear history, and contains only updates to its submodules. The submodule updates are mainly pull request merge commits, obtained by traversing

Re: GDC GCC backend

2013-12-24 Thread Johannes Pfau
Am Mon, 23 Dec 2013 06:20:51 + schrieb Mineko umineko...@gmail.com: This one's kinda short.. Is it possible to change the variable that gdc finds cc1d? Something like gdc -gcc=/whatever/gcc_backend? The -B option should do what you want.

Re: Dub and GtkD

2013-12-24 Thread Artur Skawina
On 12/23/13 19:30, Mike Wey wrote: On 12/22/2013 10:00 PM, Artur Skawina wrote: On 12/22/13 20:21, Mike Wey wrote: On 12/22/2013 03:36 PM, Russel Winder wrote: Python now uses the reflection approach to providing a Python binding to the API: PyGTK has given way to PyGobject. Has the

Making associatvie array from array of pairs

2013-12-24 Thread Dfr
Let's say i have array of kind: auto a = [[1,FF], [2, 00FF00], ...]; Is there simple way to turn it into associative array of kind: string[string] b = [1: FF, 2: 00FF00, ...];

Re: Making associatvie array from array of pairs

2013-12-24 Thread Gary Willoughby
On Tuesday, 24 December 2013 at 11:36:23 UTC, Dfr wrote: Let's say i have array of kind: auto a = [[1,FF], [2, 00FF00], ...]; Is there simple way to turn it into associative array of kind: string[string] b = [1: FF, 2: 00FF00, ...]; You can if the initial array was comprised of

Re: Making associatvie array from array of pairs

2013-12-24 Thread Philippe Sigaud
On Tue, Dec 24, 2013 at 12:36 PM, Dfr defle...@yandex.ru wrote: Let's say i have array of kind: auto a = [[1,FF], [2, 00FF00], ...]; Is there simple way to turn it into associative array of kind: string[string] b = [1: FF, 2: 00FF00, ...]; To build a value (your b) from a range

Re: Making associatvie array from array of pairs

2013-12-24 Thread bearophile
Philippe Sigaud: auto a = [[1,FF], [2, 00FF00]]; import std.algorithm: reduce; string[string] b; b = reduce!((aa, pair) { aa[pair[0]] = pair[1]; return aa;})(b,a); writeln(b); While this code seems correct (and I think it's kind of common in Scala), I consider it an

rmdirRecurse vs readonly

2013-12-24 Thread Lemonfiend
std.file.rmdirRecurse refuses to remove readonly files. How would I go about deleting them anyway?

Re: Making associatvie array from array of pairs

2013-12-24 Thread Philippe Sigaud
On Tue, Dec 24, 2013 at 1:12 PM, bearophile bearophileh...@lycos.com wrote: Philippe Sigaud: auto a = [[1,FF], [2, 00FF00]]; import std.algorithm: reduce; string[string] b; b = reduce!((aa, pair) { aa[pair[0]] = pair[1]; return aa;})(b,a); writeln(b); While this

Re: a[++i] = i vs a[i] = ++i

2013-12-24 Thread monarch_dodra
On Tuesday, 24 December 2013 at 07:08:49 UTC, David Held wrote: Ok, let's make it more interesting... The compiler is only supposed to error out on stuff that is actually illegal according to the language. What you are doing is not *illegal*, it just produces un-specified behavior. The

Re: Making associatvie array from array of pairs

2013-12-24 Thread monarch_dodra
On Tuesday, 24 December 2013 at 12:33:13 UTC, Philippe Sigaud wrote: I don't know. I really consider `reduce` a nice way to collapse a structure down to a value. I find it in many different places. Sure, map and filter are more usual, but reduce is not far behind. you use map and filter to

Re: My first D module - Critiques welcome.

2013-12-24 Thread Timon Gehr
On 12/23/2013 10:34 PM, John Carter wrote: So I resolved to learn D, and try code as idiomatically as I could. So here is a trivial module that encodes and decodes roman numerals. https://bitbucket.org/JohnCarter/roman/src/9ec5b36b9973426f35b0ab9dfd595cb3b305e39e/roman.d?at=default I also

Re: Making associatvie array from array of pairs

2013-12-24 Thread Timon Gehr
On 12/24/2013 12:36 PM, Dfr wrote: Let's say i have array of kind: auto a = [[1,FF], [2, 00FF00], ...]; Is there simple way to turn it into associative array of kind: string[string] b = [1: FF, 2: 00FF00, ...]; void main(){ import std.array, std.algorithm, std.typecons;

Re: My first D module - Critiques welcome.

2013-12-24 Thread monarch_dodra
On Monday, 23 December 2013 at 22:46:24 UTC, Gary Willoughby wrote: I like it and it seems you are grasping D well. I wonder if the entire implementation could be done using templates and all done at compile time? It would be interesting to explore. int year= fromRoman!(DXLIX); string

Re: a[++i] = i vs a[i] = ++i

2013-12-24 Thread Timon Gehr
On 12/24/2013 02:37 PM, monarch_dodra wrote: On Tuesday, 24 December 2013 at 07:08:49 UTC, David Held wrote: Ok, let's make it more interesting... The compiler is only supposed to error out on stuff that is actually illegal according to the language. What you are doing is not *illegal*, it

Re: rmdirRecurse vs readonly

2013-12-24 Thread Ali Çehreli
On 12/24/2013 04:13 AM, Lemonfiend wrote: std.file.rmdirRecurse refuses to remove readonly files. How would I go about deleting them anyway? Call std.file.setAttributes() first, which has apparently been added just three days ago: :)

Re: a[++i] = i vs a[i] = ++i

2013-12-24 Thread Timon Gehr
On 12/24/2013 01:48 AM, H. S. Teoh wrote: Agreed. Note that introducing assignment into the mix may not help matters, but complicate them even more. For example: int x=1, y=0; writeln((y = ++x) + (++y--) * (x=y)); // what does this print? ... 'y-- is not an lvalue'. Assuming

Re: Making associatvie array from array of pairs

2013-12-24 Thread Philippe Sigaud
On Tue, Dec 24, 2013 at 3:07 PM, monarch_dodra monarchdo...@gmail.com wrote: I don't know. I really consider `reduce` a nice way to collapse a structure down to a value. I find it in many different places. Sure, map and filter are more usual, but reduce is not far behind. you use map and

Re: a[++i] = i vs a[i] = ++i

2013-12-24 Thread H. S. Teoh
On Tue, Dec 24, 2013 at 05:15:15PM +0100, Timon Gehr wrote: On 12/24/2013 01:48 AM, H. S. Teoh wrote: Agreed. Note that introducing assignment into the mix may not help matters, but complicate them even more. For example: int x=1, y=0; writeln((y = ++x) + (++y--) * (x=y)); // what

Re: a[++i] = i vs a[i] = ++i

2013-12-24 Thread Timon Gehr
On 12/24/2013 06:46 PM, H. S. Teoh wrote: ... What is strict left to right evaluation, since * has to be evaluated before +? Or you consider all side-effects to be evaluated first (from left to right), and then the expression? It is about the order operands are evaluated in. Eg. if you have

Re: GDC GCC backend

2013-12-24 Thread Mineko
On Tuesday, 24 December 2013 at 08:24:09 UTC, Johannes Pfau wrote: Am Mon, 23 Dec 2013 06:20:51 + schrieb Mineko umineko...@gmail.com: This one's kinda short.. Is it possible to change the variable that gdc finds cc1d? Something like gdc -gcc=/whatever/gcc_backend? The -B option should

Re: GDC GCC backend

2013-12-24 Thread Mineko
confirmation*

Re: GDC GCC backend

2013-12-24 Thread Mineko
Never mind, I fixed it. The one time I don't use google..

Re: GDC GCC backend

2013-12-24 Thread John Colvin
On Tuesday, 24 December 2013 at 22:51:44 UTC, Mineko wrote: On Tuesday, 24 December 2013 at 08:24:09 UTC, Johannes Pfau wrote: Am Mon, 23 Dec 2013 06:20:51 + schrieb Mineko umineko...@gmail.com: This one's kinda short.. Is it possible to change the variable that gdc finds cc1d?

Re: Function declaration

2013-12-24 Thread Casper Færgemand
Never mind, found it. I searched for parameters and found it in http://dlang.org/declaration.html#DeclaratorSuffix Thanks. :3

Function declaration

2013-12-24 Thread Casper Færgemand
Where is the function declaration in the language specification? I'm trying to parse a simple void main() {} with Pegged, but I can't figure our which declarations contain the function declaration. I tried with Pegged's example D grammar, but it's unwilling to parse said program.

[Issue 314] [module] Static, renamed, and selective imports are always public

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=314 --- Comment #47 from github-bugzi...@puremagic.com 2013-12-24 00:31:41 PST --- Commits pushed to master at https://github.com/D-Programming-Language/phobos

[Issue 11559] Optlink crash with more than 2048 modules generated and debug info

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11559 --- Comment #5 from Walter Bright bugzi...@digitalmars.com 2013-12-24 01:16:36 PST --- Fixed in Optlink 8.00.14: http://ftp.digitalmars.com/optlink.zip -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ---

[Issue 11807] Functions to attempt string-to-T conversions (a la C#'s TryParse)

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11807 Peter Alexander peter.alexander...@gmail.com changed: What|Removed |Added Status|NEW

[Issue 6840] std.conv.maybeTo

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=6840 Peter Alexander peter.alexander...@gmail.com changed: What|Removed |Added CC|

[Issue 11777] [ICE] Compiler segfault in `callfunc` in `e2ir.c`

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11777 --- Comment #4 from Denis Shelomovskij verylonglogin@gmail.com 2013-12-24 16:10:31 MSK --- (In reply to comment #2) https://github.com/D-Programming-Language/dmd/commit/89e778a9eee645d2975cbb134e5cfd578bc1ab01 This will be much more

[Issue 11810] New: std.stdio.byLine/readln performance is very bad

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11810 Summary: std.stdio.byLine/readln performance is very bad Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2

[Issue 11777] [ICE] Compiler segfault in `callfunc` in `e2ir.c`

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11777 --- Comment #5 from Denis Shelomovskij verylonglogin@gmail.com 2013-12-24 16:35:06 MSK --- The more precise issue trace: 1. There is a `Scope` with `fieldinit == enclosing-fieldinit` 2. This scope's `pop` `free`-s `fieldinit`. 3.

[Issue 11810] std.stdio.byLine/readln performance is very bad

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11810 Dejan Lekic dejan.le...@gmail.com changed: What|Removed |Added CC|

[Issue 11777] [ICE] Compiler segfault in `callfunc` in `e2ir.c`

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11777 --- Comment #6 from Denis Shelomovskij verylonglogin@gmail.com 2013-12-24 16:42:30 MSK --- So now everyone can add `assert(enclosing-fieldinit != fieldinit);` check in `Scope::pop` and test if the issue is triggered in his codebase, as

[Issue 11808] std.uni.CodepointSet('А', 'Я'+1, 'а', 'я'+1) asserts

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11808 --- Comment #2 from Илья Ярошенко ilyayaroshe...@gmail.com 2013-12-24 05:21:15 PST --- As user don -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---

[Issue 11810] std.stdio.byLine/readln performance is very bad

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11810 --- Comment #2 from Peter Alexander peter.alexander...@gmail.com 2013-12-24 05:27:14 PST --- (In reply to comment #1) It has been discussed on IRC hundreds of times and we all agreed that if developer wants performance (s)he would read

[Issue 11808] std.uni.CodepointSet('А', 'Я'+1, 'а', 'я'+1) asserts

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11808 --- Comment #3 from Илья Ярошенко ilyayaroshe...@gmail.com 2013-12-24 05:38:59 PST --- I think that we need to allow in constructor: 1. an empty range: [a..a+1) 2. two or more ranges that looks like : [a..b+1) [b+1..c) like in bug example

[Issue 11808] std.uni.CodepointSet('А', 'Я'+1, 'а', 'я'+1) asserts

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11808 --- Comment #4 from Илья Ярошенко ilyayaroshe...@gmail.com 2013-12-24 05:40:28 PST --- (In reply to comment #1) (In reply to comment #0) import std.uni; auto set1 = CodepointSet('А', 'Я'+1, 'а', 'я'+1); {

[Issue 11559] Optlink crash with more than 2048 modules generated and debug info

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11559 --- Comment #6 from yebblies yebbl...@gmail.com 2013-12-25 02:38:15 EST --- How much did you bump it by? The original test case now works, but this fails: string gen() { string m; foreach(i; 0..4096) m ~=

[Issue 11811] New: Add eval to phobos

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11811 Summary: Add eval to phobos Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos

[Issue 11559] Optlink crash with more than 2048 modules generated and debug info

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11559 --- Comment #7 from Walter Bright bugzi...@digitalmars.com 2013-12-24 09:49:05 PST --- (In reply to comment #6) How much did you bump it by? I didn't bump it at all. I changed the allocation scheme for that table to one that allocated the

[Issue 11810] std.stdio.byLine/readln performance is very bad

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11810 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc ---

[Issue 11810] std.stdio.byLine/readln performance is very bad

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11810 Artem Tarasov lomerei...@gmail.com changed: What|Removed |Added CC|

[Issue 11543] multiple definition of std.regex with shared library

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11543 --- Comment #3 from Martin Nowak c...@dawg.eu 2013-12-24 11:19:55 PST --- This happens because of copy relocations, i.e. linker generates a copy of the ModuleInfo symbol in the executable's .bss section. This causes a false alarm in the

[Issue 11812] New: Associative array .keys needs 'this' at compile time

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=11812 Summary: Associative array .keys needs 'this' at compile time Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2

[Issue 9584] Exceptions in D are ludicrously slow (far worse than Java)

2013-12-24 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=9584 --- Comment #9 from hst...@quickfur.ath.cx 2013-12-24 11:58:33 PST --- (In reply to comment #8) The situation is improved, now in my benchmarks D exceptions are about only 2-2.5 times slower than Java exceptions. Further improvements in

  1   2   >