Re: newbie question: Can D do this?

2011-12-22 Thread clk
Philippe, Thank you very much for your response. It looks similar to what I've done in javascript by wrapping all function arguments into a single object literal but the D alternative you propose is a little to convoluted for a beginner like me. Perhaps I'll understand it better after I'm

Re: newbie question: can D do this?

2011-12-22 Thread clk
); -- Message: 2 Date: Tue, 20 Dec 2011 21:45:26 +0100 From: Philippe Sigaudphilippe.sig...@gmail.com To: digitalmars.D.learndigitalmars-d-learn@puremagic.com Subject: Re: newbie question: Can D do this? Message-ID: caoa6bi6baym1t3phvwy9mbrpsedk_ddjwyr-7ydo5cov2dd

Re: newbie question: Can D do this?

2011-12-22 Thread Philippe Sigaud
On Thu, Dec 22, 2011 at 16:37, clk c...@clksoft.com wrote: Philippe, Thank you very much for your response.  It looks similar to what I've done in javascript by wrapping all function arguments into a single object literal but the D alternative you propose is a little to convoluted for a

Re: newbie question: can D do this?

2011-12-22 Thread Philippe Sigaud
On Thu, Dec 22, 2011 at 16:45, clk c...@clksoft.com wrote: Philippe, I don't understand the example below to simulate the list comprehension syntax.  Are input1, input2 and input3 ranges? Yes, inputs are ranges. Sorry, I was perhaps a bit hasty in answering. The code is on github:

Re: newbie question: Can D do this?

2011-12-21 Thread mta`chrono
In PHP frameworks often use $option arrays which are some kind of key value pairs. they are merged with the default valuzes inside the function. pro: - you can pass an argument by name - you only need to pass those who needed. cons: - hash arrays it should be possible to create a similar

Re: newbie question: Can D do this?

2011-12-21 Thread Christophe
Timon Gehr , dans le message (digitalmars.D.learn:31142), a écrit : On 12/20/2011 03:18 PM, clk wrote: Thank you for your quick replies. I'm impressed by the helpfulness and dedication of the D community! Here's another one. Is there a way to pass arguments to functions by keyword as in the

Re: newbie question: Can D do this?

2011-12-20 Thread clk
, please edit your Subject line so it is more specific than Re: Contents of Digitalmars-d-learn digest... Today's Topics: 1. Re: newbie question: Can D do this? (Ali ?ehreli) 2. Re: newbie question: Can D do this? (Kai Meyer) 3. Re: newbie question: Can D do this? (Simen Kj?r?s) 4. Re

Re: newbie question: Can D do this?

2011-12-20 Thread Timon Gehr
... Today's Topics: 1. Re: newbie question: Can D do this? (Ali ?ehreli) 2. Re: newbie question: Can D do this? (Kai Meyer) 3. Re: newbie question: Can D do this? (Simen Kj?r?s) 4. Re: newbie question: Can D do this? (Ali ?ehreli) 5. Re: newbie question: Can D do this? (Jonathan M Davis

Re: newbie question: Can D do this?

2011-12-20 Thread Steven Schveighoffer
On Tue, 20 Dec 2011 09:18:16 -0500, clk c...@clksoft.com wrote: Thank you for your quick replies. I'm impressed by the helpfulness and dedication of the D community! Here's another one. Is there a way to pass arguments to functions by keyword as in the calls to f and g below? void f(int a =

Re: newbie question: Can D do this?

2011-12-20 Thread Philippe Sigaud
On 20/12/2011 14:18, clk wrote: Here's another one. Is there a way to pass arguments to functions by keyword as in the calls to f and g below? I remember a discussion about year ago or so. It seems doable to have some kind of function transformer (adaptor?) for this. from: int foo(int a =

Re: newbie question: Can D do this?

2011-12-20 Thread Philippe Sigaud
On Mon, Dec 19, 2011 at 17:17, clk c...@clksoft.com wrote: 2) D doesn't  seem to support the list comprehension syntax available in python and javascript.  Is this correct? [f(x) for x in list if condition] Correct. As other have said, it's doable by combining std functions. As fas as I

Re: newbie question: Can D do this?

2011-12-20 Thread Stewart Gordon
On 20/12/2011 20:36, Philippe Sigaud wrote: snip That is, it expects some values, then string/values couples as associative arrays. snip I've a recollection of seeing something like this in the PHP library, but I forget where. I believe it's used in some functions that have a lot of options

Re: newbie question: Can D do this?

2011-12-19 Thread simendsjo
On 19.12.2011 17:17, clk wrote: 1) Does D support something like the javascript 1.8 destructuring assigment (multiple assigment in python): [a, b] = [b, a]; I don't think so, but you can do something like this with templates: void swap(alias a, alias b)() { auto t = a; a = b; b =

Re: newbie question: Can D do this?

2011-12-19 Thread Jonathan M Davis
On Monday, December 19, 2011 11:17:43 clk wrote: Hello, I'm new to this mailing list. I'm trying to learn D to eventually use it in production code. I'm a little bit intimidated by the fact that the topics in the d-learn list look rather advanced to a newbie like me. I have 3 fairly simple

Re: newbie question: Can D do this?

2011-12-19 Thread Ali Çehreli
On 12/19/2011 08:17 AM, clk wrote: I'm a little bit intimidated by the fact that the topics in the d-learn list look rather advanced to a newbie like me. We need more newbie topics here! :) 1) Does D support something like the javascript 1.8 destructuring assigment (multiple assigment in

Re: newbie question: Can D do this?

2011-12-19 Thread Kai Meyer
On 12/19/2011 09:17 AM, clk wrote: Hello, I'm new to this mailing list. I'm trying to learn D to eventually use it in production code. I'm a little bit intimidated by the fact that the topics in the d-learn list look rather advanced to a newbie like me. I have 3 fairly simple questions: 1) Does

Re: newbie question: Can D do this?

2011-12-19 Thread Simen Kjærås
On Mon, 19 Dec 2011 17:17:43 +0100, clk c...@clksoft.com wrote: Hello, I'm new to this mailing list. I'm trying to learn D to eventually use it in production code. I'm a little bit intimidated by the fact that the topics in the d-learn list look rather advanced to a newbie like me. I have 3

Re: newbie question: Can D do this?

2011-12-19 Thread Ali Çehreli
On 12/19/2011 10:39 AM, Jonathan M Davis wrote: it's a range (see http://www.informit.com/articles/printerfriendly.aspx?p=1407357 for a general explanation of the concept of ranges) That's a great article.[1] I hope that this chapter is more beginner-friendly:

Re: newbie question: Can D do this?

2011-12-19 Thread Jakob Ovrum
On Monday, 19 December 2011 at 19:01:10 UTC, Simen Kjærås wrote: import std.typetuple : TypeTuple; import std.typecons : tuple; TypeTuple!(a, b) = tuple(b,a); There is a pull request implementing multiple variable declarations: https://github.com/D-Programming-Language/dmd/pull/341