Re: Rosetta Commatizing numbers

2017-06-01 Thread Solomon E via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 15:44:51 UTC, Ivan Kazmenko wrote: So, two custom calls, two minor changes, no sweat. Is everything right now? Even if not: that was fast, we can do another iteration. When we have a short readable solution with no special cases, the first few changes are

Re: Rosetta Commatizing numbers

2017-05-31 Thread Solomon E via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 15:44:51 UTC, Ivan Kazmenko wrote: On Wednesday, 31 May 2017 at 13:27:24 UTC, Solomon E wrote: Fine, by the numbers: 1. pi has the commas start at the wrong digit, and doesn't follow the explicit instructions to use spaces as the separator and a grouping of 5

Re: Rosetta Commatizing numbers

2017-05-31 Thread Solomon E via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 04:31:14 UTC, Ivan Kazmenko wrote: On Tuesday, 30 May 2017 at 10:54:49 UTC, Solomon E wrote: I ran into a Rosetta code solution in D that had obvious errors. It's like the author or the previous editor wasn't even trying to do it right, like a protest against how

Rosetta Commatizing numbers

2017-05-30 Thread Solomon E via Digitalmars-d-learn
I ran into a Rosetta code solution in D that had obvious errors. It's like the author or the previous editor wasn't even trying to do it right, like a protest against how many detailed rules the task had. I assumed that's not the way we want to do things in D. Then I spent all day fixing it.

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-18 Thread Solomon E via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 13:48:57 UTC, Stanislav Blinov wrote: On Tuesday, 18 April 2017 at 13:28:06 UTC, Solomon E wrote: I tried to produce an example of calling a function with variadic template arguments using special tokens __FILE__ and __LINE__. This compiles and runs, producing

Re: hidden passing of __FILE__ and __LINE__ into function

2017-04-18 Thread Solomon E via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 10:13:09 UTC, Jonathan M Davis wrote: On Monday, April 17, 2017 07:23:50 Jonathan M Davis via Digitalmars-d-learn wrote: So, if you're okay with explicitly instantiating your variadic function template instead of having the types inferred, then it can work, but

Re: Collapsing n-dimensional array to linear (1 dimensional)

2016-01-24 Thread Solomon E via Digitalmars-d-learn
On Saturday, 23 January 2016 at 07:57:55 UTC, Ali Çehreli wrote: auto collapse(R)(R r) if (isArray!R) { return r.joiner.collapse.joiner; } auto collapse(R)(R r) if (!isArray!R) { return r; } Ali, that code only passed the one test it had for collapsing a three level

Instructions for compilation from multiple source files

2014-11-10 Thread Solomon E via Digitalmars-d-learn
I wanted to know how to compile a D program that has multiple source files. I looked under Modules in the language reference, but there isn't anything there about compilation, or anything about where to put the source files, or anything about how the compiler finds the files to use. I'm

Re: Instructions for compilation from multiple source files

2014-11-10 Thread Solomon E via Digitalmars-d-learn
On Monday, 10 November 2014 at 12:21:51 UTC, bearophile wrote: It's not in flux. A simple way to compile more than one file is to put them in the same compilation unit (almost the same if you want to create a lib): dmd a.d b.d Otherwise you can also use ddmd and let it find the module

Re: Instructions for compilation from multiple source files

2014-11-10 Thread Solomon E via Digitalmars-d-learn
On Monday, 10 November 2014 at 12:49:46 UTC, ketmar via Digitalmars-d-learn wrote: you'd better not use command-line toolchain, they all aren't ready. if you can't figure out how to use some compiler of GCC suite, you'd better try some IDEs. So there's such a lack of documentation on D that

Re: Instructions for compilation from multiple source files

2014-11-10 Thread Solomon E via Digitalmars-d-learn
On Monday, 10 November 2014 at 13:11:45 UTC, Russel Winder via Digitalmars-d-learn wrote: ketmar was just being a teensy weensy bit over-dramatic. He was trying to point out that gdc is part of the GCC and so all the GCC documentation is relevant for gdc. D thus gets huge amounts of

Re: Instructions for compilation from multiple source files

2014-11-10 Thread Solomon E via Digitalmars-d-learn
On Monday, 10 November 2014 at 13:44:26 UTC, ketmar via Digitalmars-d-learn wrote: you'd better use some IDE if you have to guess such things. gdc manpage documents gdc-specific options. it even gives you some directions in see also section, which you are supposed to follow to read more about

Re: Instructions for compilation from multiple source files

2014-11-10 Thread Solomon E via Digitalmars-d-learn
On Monday, 10 November 2014 at 15:35:54 UTC, ketmar via Digitalmars-d-learn wrote: On Mon, 10 Nov 2014 14:12:12 + Solomon E via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I keep saying I want documentation or specifications. and i keep saying that if you can't find

Re: Instructions for compilation from multiple source files

2014-11-10 Thread Solomon E via Digitalmars-d-learn
On Monday, 10 November 2014 at 16:49:27 UTC, John Colvin wrote: On Monday, 10 November 2014 at 12:10:37 UTC, Solomon E wrote: I don't trust the DMD Debian package enough to install it, considering it has Google adsense ads in its HTML pages, which is against even Google's policy. Could you

Re: Instructions for compilation from multiple source files

2014-11-10 Thread Solomon E via Digitalmars-d-learn
On Monday, 10 November 2014 at 19:09:45 UTC, ketmar via Digitalmars-d-learn wrote: as for D... they are compiled object files. exactly the same thing as for c++, gnu pascal or any other language in GCC that produces .o. are you expecting them to be something special? then you'll read about

Re: Instructions for compilation from multiple source files

2014-11-10 Thread Solomon E via Digitalmars-d-learn
ketmar, I understand that GDC documentation can be as terse as it wants to be, especially in the man page, which is supposed to be the shortest, for quick command line reference. It still seems a little odd to me that there wouldn't be additional instructions somewhere in the introductory pages

Re: Instructions for compilation from multiple source files

2014-11-10 Thread Solomon E via Digitalmars-d-learn
It all works fine for me so far. I wrote a trivial test project of four d files, and compiled it all together, directly from d files, which took a couple of seconds to compile. Then instead I compiled it as two o files in an a file (using ar to archive), plus a d file, plus another o file for

Re: Global const variables

2014-10-21 Thread Solomon E via Digitalmars-d-learn
On Tuesday, 21 October 2014 at 08:48:09 UTC, safety0ff wrote: On Tuesday, 21 October 2014 at 08:25:07 UTC, bearophile wrote: Minas Mina: Aren't pure functions supposed to return the same result every time? If yes, it is correct to not accept it. But how can main() not be pure? Or, how can't

Re: Global const variables

2014-10-21 Thread Solomon E via Digitalmars-d-learn
On Tuesday, 21 October 2014 at 12:30:30 UTC, anonymous wrote: On Tuesday, 21 October 2014 at 12:08:35 UTC, Solomon E wrote: On Tuesday, 21 October 2014 at 08:48:09 UTC, safety0ff wrote: const int[] a; int[] b; static this() { b = [1]; a = b; } `a` isn't a reference to `b`. `a` is

Re: Global const variables

2014-10-21 Thread Solomon E via Digitalmars-d-learn
On Tuesday, 21 October 2014 at 14:25:20 UTC, ketmar via Digitalmars-d-learn wrote: On Tue, 21 Oct 2014 13:43:29 + Solomon E via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: `b[0] = 8;` or `b[] = 8;` changes a. Printing the values for a and b shows they're different

Re: Global const variables

2014-10-21 Thread Solomon E via Digitalmars-d-learn
On Tuesday, 21 October 2014 at 15:51:27 UTC, MachineCode wrote: ... ... pure functions are also supposed to don't use global variables at all, according to functional programming paradigm Pure functions are immutables (constants but not const in the D or C++ senses) and can use other

Does the grammar allow an alias statement without a semicolon?

2014-10-17 Thread Solomon E via Digitalmars-d-learn
Hi, everyone, first post here. I'm trying to learn to parse D code. The line alias StorageClassesopt BasicType Declarator in http://dlang.org/grammar#AliasDeclaration is apparently missing a semicolon after Declarator. If that line is not missing a semicolon, could someone please explain

Re: Does the grammar allow an alias statement without a semicolon?

2014-10-17 Thread Solomon E via Digitalmars-d-learn
Thank you both. That DGrammar project has some different names for the nonterminals in its grammar, and a different arrangement, but it confirms there should be a semicolon with any alias statement. I'm just trying to parse D when I read it myself so far, and figure out how the grammar works a