Re: Tuple!(string, int))[] field_orders

2019-03-14 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 14 March 2019 at 15:29:28 UTC, Ozan wrote: Hi In vibe.d / data / mongo / collection I found the function * ensureIndex(Tuple!(string, int))[] field_orders) What could be the right way to use "Tuple!(string, int))[] field_orders"? I tried different ways like [Tuple!(&quo

Tuple!(string, int))[] field_orders

2019-03-14 Thread Ozan via Digitalmars-d-learn
Hi In vibe.d / data / mongo / collection I found the function * ensureIndex(Tuple!(string, int))[] field_orders) What could be the right way to use "Tuple!(string, int))[] field_orders"? I tried different ways like [Tuple!("a", 1), Tuple!("b", 2)]", but com

Re: User imput string int and float[DOUBT]

2017-02-16 Thread Jean Cesar via Digitalmars-d-learn
On Thursday, 16 February 2017 at 22:44:58 UTC, Ali Çehreli wrote: On 02/16/2017 02:05 PM, Jean Cesar wrote: > So I used get methods and sets only as initial pattern to netender the > functioning of the language in relation to some concepts of the same Makes sense... > how to leave a very

Re: User imput string int and float[DOUBT]

2017-02-16 Thread Ali Çehreli via Digitalmars-d-learn
On 02/16/2017 02:05 PM, Jean Cesar wrote: > So I used get methods and sets only as initial pattern to netender the > functioning of the language in relation to some concepts of the same Makes sense... > how to leave a very small code with the largest number of > Possible functionality type I

Re: User imput string int and float[DOUBT]

2017-02-16 Thread Jean Cesar via Digitalmars-d-learn
On Thursday, 16 February 2017 at 02:17:49 UTC, Ali Çehreli wrote: On 02/15/2017 05:49 PM, Jean Cesar wrote: > So I'm a beginner in this language and have very little time I started > I'm interested in apprehending concepts of object orientation > polymorphism inheritance, multiple inheritance

Re: User imput string int and float[DOUBT]

2017-02-15 Thread Ali Çehreli via Digitalmars-d-learn
On 02/15/2017 05:49 PM, Jean Cesar wrote: > So I'm a beginner in this language and have very little time I started > I'm interested in apprehending concepts of object orientation > polymorphism inheritance, multiple inheritance as in c ++ D is similar to C++ but also very different. > but I

Re: User imput string int and float[DOUBT]

2017-02-15 Thread Jean Cesar via Digitalmars-d-learn
On Wednesday, 15 February 2017 at 23:40:41 UTC, Ali Çehreli wrote: On 02/15/2017 03:20 PM, Jean Cesar wrote: How do I make a class person where I use set and get methods to imput the user type: I have some information here: http://ddili.org/ders/d.en/input.html You should also know how

Re: User imput string int and float[DOUBT]

2017-02-15 Thread Ali Çehreli via Digitalmars-d-learn
On 02/15/2017 03:20 PM, Jean Cesar wrote: How do I make a class person where I use set and get methods to imput the user type: I have some information here: http://ddili.org/ders/d.en/input.html You should also know how to read strings: http://ddili.org/ders/d.en/strings.html And this

User imput string int and float[DOUBT]

2017-02-15 Thread Jean Cesar via Digitalmars-d-learn
How do I make a class person where I use set and get methods to imput the user type: Import std.stdio; class person { private: string name, address; int age; float height; public: void setNome() { write("Enter Your Name:"); // the problem is here how am I going to read the

Re: string-int[] array

2015-03-10 Thread Kagamin via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:41:44 UTC, FG wrote: Except that with this solution you will confuse empty strings with ints. The idea was to only make it memory-safe without union.

Re: string-int[] array

2015-03-09 Thread ketmar via Digitalmars-d-learn
On Sun, 08 Mar 2015 18:57:37 +, Kagamin wrote: http://dpaste.dzfl.pl/2c8d4a7d9ef0 like this. i hate annoying beginners too, but not to SUCH extent. signature.asc Description: PGP signature

string-int[] array

2015-03-08 Thread Dennis Ritchie via Digitalmars-d-learn
Is it possible to create such an array in which you can store strings and numbers at the same time? string-int[] array = [4, five];

Re: string-int[] array

2015-03-08 Thread Paul via Digitalmars-d-learn
On Sunday, 8 March 2015 at 18:05:33 UTC, Dennis Ritchie wrote: Is it possible to create such an array in which you can store strings and numbers at the same time? string-int[] array = [4, five]; As there's no mention of performance, what's wrong with a plain old string array with a bit

Re: string-int[] array

2015-03-08 Thread FG via Digitalmars-d-learn
On 2015-03-08 at 20:26, Meta wrote: On Sunday, 8 March 2015 at 18:57:38 UTC, Kagamin wrote: http://dpaste.dzfl.pl/2c8d4a7d9ef0 like this. What in the world is that code doing? I'm having a hard time wrapping my head around this. It's a trick to reuse string internals to store an int. A

Re: string-int[] array

2015-03-08 Thread Kagamin via Digitalmars-d-learn
http://dpaste.dzfl.pl/2c8d4a7d9ef0 like this.

Re: string-int[] array

2015-03-08 Thread Max Klyga via Digitalmars-d-learn
On 2015-03-08 21:11:42 +, Paul said: On Sunday, 8 March 2015 at 18:05:33 UTC, Dennis Ritchie wrote: Is it possible to create such an array in which you can store strings and numbers at the same time? string-int[] array = [4, five]; As there's no mention of performance, what's wrong

Re: string-int[] array

2015-03-08 Thread Paul via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:18:31 UTC, Max Klyga wrote: On 2015-03-08 21:11:42 +, Paul said: On Sunday, 8 March 2015 at 18:05:33 UTC, Dennis Ritchie wrote: Is it possible to create such an array in which you can store strings and numbers at the same time? string-int[] array = [4, five

Re: string-int[] array

2015-03-08 Thread Dennis Ritchie via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:18:31 UTC, Max Klyga wrote: OP is fighting a loosing battle in flame war on some obscure forum. F# enthusiast trolls OP into solving stupid puzzles that are trivial in F# (or any ML-family language) and clumsy in C-family languages. In language holy wars the

Re: string-int[] array

2015-03-08 Thread Meta via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:41:44 UTC, FG wrote: On 2015-03-08 at 20:26, Meta wrote: On Sunday, 8 March 2015 at 18:57:38 UTC, Kagamin wrote: http://dpaste.dzfl.pl/2c8d4a7d9ef0 like this. What in the world is that code doing? I'm having a hard time wrapping my head around this. It's a

Re: Conversion string-int

2014-06-07 Thread monarch_dodra via Digitalmars-d-learn
On Saturday, 7 June 2014 at 20:53:03 UTC, Paul wrote: I can not understand, why this code works: char s[2] = ['0', 'A']; string ss = to!string(s); writeln(parse!uint(ss, 16)); but this can deduces template: char s[2] = ['0', 'A']; writeln(parse!uint(to!string(s), 16));

Re: Conversion string-int

2014-06-07 Thread anonymous via Digitalmars-d-learn
On Saturday, 7 June 2014 at 20:53:03 UTC, Paul wrote: I can not understand, why this code works: char s[2] = ['0', 'A']; string ss = to!string(s); writeln(parse!uint(ss, 16)); but this can deduces template: char s[2] = ['0', 'A']; writeln(parse!uint(to!string(s), 16));

Re: Conversion string-int

2014-06-07 Thread Paul via Digitalmars-d-learn
On Saturday, 7 June 2014 at 21:15:37 UTC, monarch_dodra wrote: On Saturday, 7 June 2014 at 20:53:03 UTC, Paul wrote: I can not understand, why this code works: char s[2] = ['0', 'A']; string ss = to!string(s); writeln(parse!uint(ss, 16)); but this can deduces template: char s[2]

Re: Conversion string-int

2014-06-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Sat, 07 Jun 2014 20:53:02 + Paul via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I can not understand, why this code works: char s[2] = ['0', 'A']; string ss = to!string(s); writeln(parse!uint(ss, 16)); but this can deduces template: char s[2]

How to convert int type to string int ?

2014-06-01 Thread bioinfornatics via Digitalmars-d-learn
Hi, All is in the title. I need this to do a tupleof enhanced, that mean: - .tupleof need an instance me i want to do this on type diretcly - .tupleof do not bind to member name i need this for this i strat to this code: import std.stdio; import std.typecons; import std.conv; struct

Re: How to convert int type to string int ?

2014-06-01 Thread bioinfornatics via Digitalmars-d-learn
On Sunday, 1 June 2014 at 13:34:20 UTC, bioinfornatics wrote: Hi, All is in the title. I need this to do a tupleof enhanced, that mean: - .tupleof need an instance me i want to do this on type diretcly - .tupleof do not bind to member name i need this for this i strat to this code:

Re: How to convert int type to string int ?

2014-06-01 Thread Tobias Pankrath via Digitalmars-d-learn
Maybe http://dlang.org/property.html#stringof helps.

Re: How to convert int type to string int ?

2014-06-01 Thread bioinfornatics via Digitalmars-d-learn
On Sunday, 1 June 2014 at 13:52:27 UTC, Tobias Pankrath wrote: Maybe http://dlang.org/property.html#stringof helps. yes that help a lot thanks

Re: How to convert int type to string int ?

2014-06-01 Thread bioinfornatics via Digitalmars-d-learn
I bam close to be done import std.stdio; import std.typecons; import std.conv; struct Coord { int x; int y; int z; } template toTuple(T){ static string maker(){ string statement = alias Tuple!(; foreach(const memberName; __traits(allMembers, T)){

Re: How to convert int type to string int ?

2014-06-01 Thread bioinfornatics via Digitalmars-d-learn
On Sunday, 1 June 2014 at 13:58:03 UTC, bioinfornatics wrote: On Sunday, 1 June 2014 at 13:52:27 UTC, Tobias Pankrath wrote: Maybe http://dlang.org/property.html#stringof helps. yes that help a lot thanks End of spam ( joke ^^) I found it :-) import std.stdio; import std.typecons; import

Re: string[int[][]] ??

2010-07-26 Thread dcoder
== Quote from Stewart Gordon (smjg_1...@yahoo.com)'s article Further to what others have said, why use strings? There are only 12 possible chess pieces (black and white), plus blank, so probably the most efficient approach is char[8][8] board; and use uppercase letters for white and

Re: string[int[][]] ??

2010-07-24 Thread Stewart Gordon
dcoder wrote: == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article This is what I think you should use: string[int[2]] snip board[[0,0]] = Rook; Further to what others have said, why use strings? There are only 12 possible chess pieces (black and white), plus blank, so

Re: string[int[][]] ??

2010-07-23 Thread Heywood Floyd
string[int[2]] board; board[[0,0]] = Rook; board[[0,1]] = Knight; foreach( pos, val; board) { writefln( %s: %s, pos, val); } Output: 2 9903680: Knight 2 9903696: Rook Changing the declaration to string[int[]] board; makes it work (for me). BR /HF

string[int[][]] ??

2010-07-22 Thread dcoder
Hello. I want to use associative arrays, but have a 2-d int array as my index. so something like: string[int[][]] chessboard; chessboard[[0,0]] = Rook; chessboard[[0,1]] = Knight; Is this possible? I can declare chessboard without any compiler complaints, but I haven't figured out how

Re: string[int[][]] ??

2010-07-22 Thread dcoder
== Quote from dcoder (dco...@devnull.com)'s article Hello. I want to use associative arrays, but have a 2-d int array as my index. so something like: string[int[][]] chessboard; chessboard[[0,0]] = Rook; chessboard[[0,1]] = Knight; Is this possible? I can declare chessboard without any

Re: string[int[][]] ??

2010-07-22 Thread awishformore
On 22/07/2010 22:57, dcoder wrote: == Quote from dcoder (dco...@devnull.com)'s article Hello. I want to use associative arrays, but have a 2-d int array as my index. so something like: string[int[][]] chessboard; chessboard[[0,0]] = Rook; chessboard[[0,1]] = Knight; Is this possible? I can

Re: string[int[][]] ??

2010-07-22 Thread dcoder
== Quote from awishformore (awishform...@nospam.plz)'s article How about string[][]? ;) yes, heheh... you are right. I'm over thinking things. Sorry about the noise.

Re: string[int[][]] ??

2010-07-22 Thread Steven Schveighoffer
On Thu, 22 Jul 2010 16:57:59 -0400, dcoder dco...@devenull.dev wrote: == Quote from dcoder (dco...@devnull.com)'s article Hello. I want to use associative arrays, but have a 2-d int array as my index. so something like: string[int[][]] chessboard; chessboard[[0,0]] = Rook; chessboard[[0,1

Re: string[int[][]] ??

2010-07-22 Thread dcoder
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article This is what I think you should use: string[int[2]] Although, I'm not sure if you can then do something like: chessboard[[0,1]] = Rook; as the [0, 1] is typed as a dynamic array. If it does work, it may actually create [0,1