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.