Re: Put Tuple in templates in a class fails

2012-05-13 Thread Xan
Thank you very much, Philippe. I have several questions: * Why do you think I can't compose functions with tuples? Your implentation does exactly this, isn't? * What is RHS? Thanks, Xan. On Thursday, 10 May 2012 at 20:17:12 UTC, Philippe Sigaud wrote: On Thu, May 10, 2012 at 4:

Put Tuple in templates in a class fails

2012-05-10 Thread Xan
e, it is a prova_amb_tuples_a_Algorisme.Algorisme!(int,int).Algorisme prova_amb_tuples_a_Algorisme.d:84: Error: 'alg2' is not of arithmetic type, it is a prova_amb_tuples_a_Algorisme.Algorisme!(int,int).Algorisme What fails? Thanks in advance, Xan.

Re: Operator overloading

2012-04-21 Thread Xan
Thank you very very much, Dmitry. Now all it's fine! Xan. On Friday, 20 April 2012 at 19:51:40 UTC, Dmitry Olshansky wrote: On 20.04.2012 23:33, Xan wrote: Yes, you're wright. So in. But what fails? I reveice these errors and I have no idea what fails! Sorry, the errors are:

Re: Operator overloading

2012-04-20 Thread Xan
On Friday, 20 April 2012 at 18:47:14 UTC, Dmitry Olshansky wrote: On 20.04.2012 19:14, Xan wrote: On Friday, 20 April 2012 at 14:18:37 UTC, Dmitry Olshansky wrote: On 20.04.2012 18:10, Xan wrote: What fails if I want to define this: Algorisme!(T,V) opBinary(string op)(Algorisme!(T,U) alg

Re: Operator overloading

2012-04-20 Thread Xan
Yes, you're wright. So in. But what fails? I reveice these errors and I have no idea what fails! Sorry, the errors are: $ gdmd-4.6 algorisme.d algorisme.d:35: Error: 'this' is only defined in non-static member functions, not __funcliteral1 algorisme.d:35: Error: function algorisme.Algorism

Re: Operator overloading

2012-04-20 Thread Xan
On Friday, 20 April 2012 at 14:18:37 UTC, Dmitry Olshansky wrote: On 20.04.2012 18:10, Xan wrote: What fails if I want to define this: Algorisme!(T,V) opBinary(string op)(Algorisme!(T,U) alg) { Algorisme!(T,V) opBinary(string op, T)(Algorisme!(T,U) alg) { You need to name what T is and

Re: Operator overloading

2012-04-20 Thread Xan
On Friday, 20 April 2012 at 14:10:31 UTC, Xan wrote: What fails if I want to define this: Algorisme!(T,V) opBinary(string op)(Algorisme!(T,U) alg) { if (op=="*") { //fer la funció composicio return new Algorisme!(T,V)("Composici

Re: Operator overloading

2012-04-20 Thread Xan
t of arithmetic type, it is a algorisme.Algorisme!(int,int).Algorisme Thanks in advance, Xan.

Re: Operator overloading

2012-04-20 Thread Xan
On Thursday, 19 April 2012 at 20:59:05 UTC, Jonathan M Davis wrote: On Thursday, April 19, 2012 21:14:43 Xan wrote: Hi, I read http://dlang.org/operatoroverloading.html but in my code it does not work. I tried to overload '*' binary operator in my class Algorisme: [...] class Alg

Re: Operator overloading

2012-04-19 Thread Xan
On Thursday, 19 April 2012 at 19:24:40 UTC, Dmitry Olshansky wrote: On 19.04.2012 23:14, Xan wrote: Hi, I read http://dlang.org/operatoroverloading.html but in my code it does not work. I tried to overload '*' binary operator in my class Algorisme: [...] class Algorisme(U,V) {

Operator overloading

2012-04-19 Thread Xan
#x27;this') algorisme.d:31: found 'alg' when expecting ')' algorisme.d:31: no identifier for declarator opBinary(Algorisme(U, V)) algorisme.d:31: semicolon expected following function declaration algorisme.d:31: Declaration expected, not ')' algorisme.d:35: unrecognized declaration Why it fails? Anyone could help me? Thanks, Xan.

Re: delegates vs functions => practical consequences

2012-04-19 Thread Xan
On Thursday, 19 April 2012 at 11:46:59 UTC, Steven Schveighoffer wrote: On Wed, 18 Apr 2012 17:07:07 -0400, Xan wrote: Hi, I want to know what is most interesting for me: delegates or functions. I consulted sources but none say the practical consequences of such election. What can I do

delegates vs functions => practical consequences

2012-04-18 Thread Xan
Hi, I want to know what is most interesting for me: delegates or functions. I consulted sources but none say the practical consequences of such election. What can I do and what can't I do with functions and delegates? Please, be didactics, I'm a newbee Thanks, Xan.

Re: Templates in classes => what is wrong?

2012-04-18 Thread Xan
On Tuesday, 17 April 2012 at 18:39:16 UTC, Xan wrote: On Tuesday, 17 April 2012 at 18:25:21 UTC, Ali Çehreli wrote: On 04/17/2012 11:13 AM, Xan wrote: > The idea is behind this https://gist.github.com/2407923 > But I receive: > > $ gdmd-4.6 algorisme_code.d > algorisme_c

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 18:25:21 UTC, Ali Çehreli wrote: On 04/17/2012 11:13 AM, Xan wrote: > The idea is behind this https://gist.github.com/2407923 > But I receive: > > $ gdmd-4.6 algorisme_code.d > algorisme_code.d:22: Error: variable codi cannot be read

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 18:00:55 UTC, Xan wrote: On Tuesday, 17 April 2012 at 15:59:25 UTC, Ali Çehreli wrote: On 04/17/2012 08:42 AM, Xan wrote: > How to get the "code" of a function or delegate > > |___string toString() { > |___|___return format("%s (versió %s

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 18:00:55 UTC, Xan wrote: On Tuesday, 17 April 2012 at 15:59:25 UTC, Ali Çehreli wrote: On 04/17/2012 08:42 AM, Xan wrote: > How to get the "code" of a function or delegate > > |___string toString() { > |___|___return format("%s (versió %s

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 15:59:25 UTC, Ali Çehreli wrote: On 04/17/2012 08:42 AM, Xan wrote: > How to get the "code" of a function or delegate > > |___string toString() { > |___|___return format("%s (versió %s): Domini -> Recorregut, %s(x) = &g

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 15:30:36 UTC, Ali Çehreli wrote: On 04/17/2012 08:17 AM, Xan wrote: Off-topic, could can I define toString having this structure: (versió ): -> , ? (For example, in https://gist.github.com/2394274 I want that Doblar displays as: Doblar (versió 1):

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 15:21:30 UTC, Dejan Lekic wrote: On Tuesday, 17 April 2012 at 14:57:18 UTC, Xan wrote: On Tuesday, 17 April 2012 at 01:31:43 UTC, Kenji Hara wrote: On Monday, 16 April 2012 at 18:48:52 UTC, Xan wrote: On Sunday, 15 April 2012 at 19:30:27 UTC, Ali Çehreli wrote

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
Off-topic, could can I define toString having this structure: (versió ): -> , ? (For example, in https://gist.github.com/2394274 I want that Doblar displays as: Doblar (versió 1): int -> int, { return 2 * a; } Thanks a lot, Xan.

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 01:31:43 UTC, Kenji Hara wrote: On Monday, 16 April 2012 at 18:48:52 UTC, Xan wrote: On Sunday, 15 April 2012 at 19:30:27 UTC, Ali Çehreli wrote: On 04/15/2012 11:39 AM, Xan wrote: > On Sunday, 15 April 2012 at 11:23:37 UTC, John Chapman > wrote: >> O

Re: A "general" tag

2012-04-16 Thread Xan
Uf!, it's more than I can process It's really a **complicated** thing to do that in D. On Monday, 16 April 2012 at 07:50:28 UTC, Denis Shelomovskij wrote: 15.04.2012 0:31, Xan написал: On Saturday, 14 April 2012 at 19:40:06 UTC, Aleksandar Ružičić wrote: On Saturday, 14 April

Re: Templates in classes => what is wrong?

2012-04-16 Thread Xan
On Sunday, 15 April 2012 at 19:30:27 UTC, Ali Çehreli wrote: On 04/15/2012 11:39 AM, Xan wrote: > On Sunday, 15 April 2012 at 11:23:37 UTC, John Chapman wrote: >> On Sunday, 15 April 2012 at 11:16:43 UTC, Xan wrote: >>> >>> int main(string [] args) >>>

Re: Templates in classes => what is wrong?

2012-04-15 Thread Xan
On Sunday, 15 April 2012 at 11:23:37 UTC, John Chapman wrote: On Sunday, 15 April 2012 at 11:16:43 UTC, Xan wrote: int main(string [] args) { auto alg = Algorisme!(int,int); Should be: auto alg = new Algorisme!(int, int); alg.nom = "Doblar"; alg.versio = 1;

Templates in classes => what is wrong?

2012-04-15 Thread Xan
;;' following statement algorisme.d:25: found 'EOF' when expecting '}' following compound statement What is wrong? Thanks in advance, Xan.

Re: A "general" tag

2012-04-14 Thread Xan
On Saturday, 14 April 2012 at 19:40:06 UTC, Aleksandar Ružičić wrote: On Saturday, 14 April 2012 at 19:17:52 UTC, Xan wrote: Hi, I try to translate a script I wrote in Fantom [www.fantom.org]. In my script, I have a type "Tag" defined as a triple of: - String (the name of the ta

A "general" tag

2012-04-14 Thread Xan
how to define Type and Object in D. Thanks in advance, Xan. PS: Please, be patient, I'm a newbee.

Re: Name of files causes error. Why?

2012-04-13 Thread Xan
On Friday, 13 April 2012 at 04:16:52 UTC, Jesse Phillips wrote: On Wednesday, 11 April 2012 at 19:33:58 UTC, Xan wrote: Hi, With helloworld program named with score or underscore, I receive the following __annoying__ error: $ gdmd-4.6 hola-temp.d hola-temp.d: Error: module hola-temp has non

Re: Name of files causes error. Why?

2012-04-12 Thread Xan
On Wednesday, 11 April 2012 at 19:50:18 UTC, Steven Schveighoffer wrote: On Wed, 11 Apr 2012 15:33:56 -0400, Xan wrote: Hi, With helloworld program named with score or underscore, I receive the following __annoying__ error: $ gdmd-4.6 hola-temp.d hola-temp.d: Error: module hola-temp has

Name of files causes error. Why?

2012-04-11 Thread Xan
oying Thanks in advance, Xan.

Re: Passing function as values and returning functions

2012-04-11 Thread Xan
On Wednesday, 11 April 2012 at 13:04:01 UTC, Steven Schveighoffer wrote: On Wed, 11 Apr 2012 08:53:00 -0400, Xan wrote: Thanks, Steve, but another problem: [snip] void main() { |___writeln(g(f)(1)); } writeln(g(&f)(1)); Unlike C, you *must* take the address of a function symbo

Re: Passing function as values and returning functions

2012-04-11 Thread Xan
On Wednesday, 11 April 2012 at 12:19:06 UTC, Steven Schveighoffer wrote: On Wed, 11 Apr 2012 08:08:44 -0400, Xan wrote: On Wednesday, 11 April 2012 at 11:59:14 UTC, Jacob Carlborg wrote: Use "delegate" or "function" both for the argument type and return type. H

Re: Passing function as values and returning functions

2012-04-11 Thread Xan
On Wednesday, 11 April 2012 at 11:59:14 UTC, Jacob Carlborg wrote: On 2012-04-11 13:10, Xan wrote: Hi, Following the thread of Higher-order functions, how can I do to pass a function as a parameter and return a function. That is a something like: import std.functional, std.stdio; int f

Passing function as values and returning functions

2012-04-11 Thread Xan
: expected 1 function arguments, not 0 functions.d:13: Error: function functions.g (int function(int a) p) is not callable using argument types (int) functions.d:13: Error: cannot implicitly convert expression (f()) of type int to int function(int a) Thanks, Xan.

Re: Higher-order functions?

2012-04-11 Thread Xan
Apparently your compiler does not support parameter type deduction yet. void main () { writeln("add: ", someprocedure(2, 3, (int a, int b) { return a + b; })); writeln("multiply: ", someprocedure(2, 3, (int a, int b) { return a * b; })); } Yes, now it works! Thanks,

Re: Higher-order functions?

2012-04-11 Thread Xan
On Wednesday, 11 April 2012 at 10:14:21 UTC, Mirko Pilger wrote: What is the error? e.g. try this: auto someprocedure (int a, int b, int delegate (int, int) f) I receive the same error

Re: Higher-order functions?

2012-04-11 Thread Xan
On Wednesday, 11 April 2012 at 09:43:27 UTC, Timon Gehr wrote: On 04/11/2012 11:37 AM, Xan wrote: On Wednesday, 11 April 2012 at 09:17:12 UTC, Jacob Carlborg wrote: On 2012-04-11 10:45, Xan wrote: Good answer. For the other hand, what is the simplest method for implementing this (in

Re: Higher-order functions?

2012-04-11 Thread Xan
On Wednesday, 11 April 2012 at 09:17:12 UTC, Jacob Carlborg wrote: On 2012-04-11 10:45, Xan wrote: Good answer. For the other hand, what is the simplest method for implementing this (in pseucode) in D: Sure: FUNC someprocedure(int a, int b, func f) int RETURN f(a, b) } And call it with

Re: Higher-order functions?

2012-04-11 Thread Xan
ine("multiply: " .. someprocedure(2, 3, { a, b => a * b })) (Read the => as "gives") Is it possible to have this? Thanks, Xan On Wednesday, 11 April 2012 at 00:03:05 UTC, Timon Gehr wrote: On 04/11/2012 01:13 AM, Jonas H. wrote: Hi everyone, does D have any runtime higher-

Re: HelloWordl in Webserver

2012-04-04 Thread Xan
On Tuesday, 3 April 2012 at 13:33:19 UTC, Adam D. Ruppe wrote: On Tuesday, 3 April 2012 at 08:42:01 UTC, Xan wrote: I receive errors: I changed some stuff since the beginning of thi thread. cgi.d now includes a http server without needing the other modules. So if you just get the new cgi.d

Re: HelloWordl in Webserver

2012-04-03 Thread Xan
And with comment the UTC line I get: s$ gdmd-4.6 server.d cgi.d netman.d httpd.d Notice: As of Phobos 2.055, std.date and std.dateparse have been deprecated. They will be removed in February 2012. Please use std.datetime instead. httpd.d:72: Error: undefined identifier peerAddress httpd.d:72:

Re: HelloWordl in Webserver

2012-04-03 Thread Xan
Thanks, You can just comment out the code there (afaik it is only a custom formatting routine), or compile with the -d flag. $ gdmd-4.6 -d server.d cgi.d netman.d httpd.d Notice: As of Phobos 2.055, std.date and std.dateparse have been deprecated. They will be removed in February 2012. Pl

Re: HelloWordl in Webserver

2012-04-03 Thread Xan
On Tuesday, 3 April 2012 at 08:42:01 UTC, Xan wrote: I receive errors: xan@gerret:~/proves/dlang-proves$ ls cgi.d functions.d httpd.d netman.d server.d xan@gerret:~/proves/dlang-proves$ gdmd-4.6 server.d cgi.d netman.d httpd.d httpd.d:5: Error: module netman is in file 'arsd/net

Re: HelloWordl in Webserver

2012-04-03 Thread Xan
I receive errors: xan@gerret:~/proves/dlang-proves$ ls cgi.d functions.d httpd.d netman.d server.d xan@gerret:~/proves/dlang-proves$ gdmd-4.6 server.d cgi.d netman.d httpd.d httpd.d:5: Error: module netman is in file 'arsd/netman.d' which cannot be read import path[0] = /usr/

Re: HelloWordl in Webserver

2012-03-19 Thread Xan
On Sunday, 18 March 2012 at 05:19:48 UTC, Kapps wrote: On Saturday, 17 March 2012 at 20:52:33 UTC, Xan wrote: So, there is not built-in functions? Thanks, Xan. There's no built in webserver class, and it's not something that should be in the standard library in the first place.

Re: HelloWordl in Webserver

2012-03-17 Thread Xan
So, there is not built-in functions? Thanks, Xan. On Saturday, 17 March 2012 at 20:18:39 UTC, Adam D. Ruppe wrote: On Saturday, 17 March 2012 at 20:08:24 UTC, Xan wrote: I'm convinced there is a D equivalent? It all depends on the library. If you use my code https://github.com/adamd

HelloWordl in Webserver

2012-03-17 Thread Xan
I dont' want to battle among languages, but I see that in Golang there is a beatiful solution to display HelloWorld program in web server [rosettacode.org/wiki/Hello_world/Web_server#Go]. I'm convinced there is a D equivalent? Can someone say what's its aspect? Thanks in advance, Xan.

Re: actors library?

2012-01-24 Thread Xan xan
Something like Class MyActor : Actor { receive { case i int: writeln("Received integer: ", i) } } pseudocode 2012/1/23 Timon Gehr : > On 01/23/2012 08:01 PM, Xan xan wrote: >> >> Hi. >> >> Is there any actors library in D. Spawn and etc is ok, bu

actors library?

2012-01-23 Thread Xan xan
Hi. Is there any actors library in D. Spawn and etc is ok, but I want more high-level thing and actors it's the best I get, I think. I searched and nothing. I'm interested in D 2.0 or 1.0. Whatever! Thanks in advace, Xan.

Re: Reading web pages

2012-01-21 Thread Xan xan
string to type uint] 2012/1/20 Bystroushaak : > On 20.1.2012 18:42, Xan xan wrote: >> >> Thank you very much. I should invite you to a beer ;-) > > > Write me if you will be in prag/czech republic :) > > >> For the other hand, >> >> I get this erro

Re: Reading web pages

2012-01-21 Thread Xan xan
now what happens!!! And no, I don't live in Czech Republic: we have to postpone the invitation ;-) 2012/1/20 Bystroushaak : > On 20.1.2012 18:42, Xan xan wrote: >> >> Thank you very much. I should invite you to a beer ;-) > > > Write me if you will be in prag/czech republi

Re: Reading web pages

2012-01-20 Thread Xan xan
cast(ubyte[]) navegador.get(a)); > > > On 20.1.2012 18:18, Xan xan wrote: >> >> Mmmm... I understand it. But is there any way of circumvent it? >> Perhaps I could write to one file, isn't? >> >> >> >> 2012/1/20 Bystroushaak: >>> >>

Re: Reading web pages

2012-01-20 Thread Xan xan
} } catch (Exception e) { writeln("[Excepció: ", e, "]"); } return 0; } } In theory, tamany.length is completely defined. Xan. 2012/1/20 Bystroushaak : > rawWrite(): > &g

Re: Reading web pages

2012-01-20 Thread Xan xan
Mmmm... I understand it. But is there any way of circumvent it? Perhaps I could write to one file, isn't? 2012/1/20 Bystroushaak : > Thats because you are trying writeln binary data, and that is impossible, > because writeln IMHO checks UTF8 validity. > > > On 20.1.2012

Re: Reading web pages

2012-01-20 Thread Xan xan
: > https://github.com/Bystroushaak/DHTTPClient/blob/master/examples/download_binary_file.d > > > On 20.1.2012 18:00, Bystroushaak wrote: >> >> It is unlimited, you just have to cast output to ubyte[]: >> >> std.file.write("logo3w.png", cast(ubyte[]) >> cl.ge

Re: Reading web pages

2012-01-20 Thread Xan xan
Before and now, I get this error: $ ./spider http://static.arxiv.org/pdf/1109.4897.pdf [Excepció: std.conv.ConvException@/usr/include/d2/4.6/std/conv.d(1640): Can't convert value `HTT' of type string to type uint] The code: //D 2.0 //gdmd-4.6 => surt el fitxer amb el mateix nom i .o //Usa https

Re: Reading web pages

2012-01-20 Thread Xan xan
: "300", >> "Connection" : "keep-alive" >> ]; >> >> /// Headers from firefox 3.6.13 on Linux >> public enum string[string] LFFHeaders = [ >> "User-Agent" : "Mozilla/5.0 (X11; U; Linux i686; cs; rv:1.9.2.3) >> Gecko/

Re: Reading web pages

2012-01-20 Thread Xan xan
k : > With dmd 2.057 on my linux machine: > > bystrousak:DHTTPClient,0$ dmd spider.d dhttpclient.d > bystrousak:DHTTPClient,0$ ./spider http://kitakitsune.org > [Contingut: "http://www.w3.org/TR/html4/loose.dtd";> > > > . > > > > On 20.1.2012

Re: Reading web pages

2012-01-20 Thread Xan xan
I get errors: xan@gerret:~/yottium/@codi/aranya-d2.0$ gdmd-4.6 spider.d spider.o: In function `_Dmain': spider.d:(.text+0x4d): undefined reference to `_D11dhttpclient10HTTPClient7__ClassZ' spider.d:(.text+0x5a): undefined re

Re: Reading web pages

2012-01-20 Thread Xan xan
Thanks for that. The standard library would include it. It will easy the things high level, please. For the other hand, how to specify the protocol? It's not the same http://foo than ftp://foo Thanks, Xan. 2012/1/20 Bystroushaak : > You can always use my module: >  https:/

Re: Reading web pages

2012-01-20 Thread Xan xan
Nope: xan@gerret:~/yottium/@codi/aranya-d2.0$ gdmd-4.6 aranya.d xan@gerret:~/yottium/@codi/aranya-d2.0$ ./aranya www.google.com std.socket.TcpSocket What fails? 2012/1/19 Timon Gehr : > On 01/19/2012 04:30 PM, Xan xan wrote: >> >> Hi, >> >> I want to simply code

Reading web pages

2012-01-19 Thread Xan xan
om std.socket.AddressException@../../../src/libphobos/std/socket.d(697): Unable to resolve host 'http://www.google.com' What fails? Thanks in advance, Xan.