Re: std.process.execute without capturing stderr?

2018-09-21 Thread berni via Digitalmars-d-learn
On Thursday, 20 September 2018 at 14:10:44 UTC, Steven Schveighoffer wrote: Hm... 2.079.0 had it: Sorry, I made a mistake while testing and after I found out, that it was not available in the documentation at dpldocs.info I concluded, that it must be a really new feature. But now it seems

Re: Simple parallel foreach and summation/reduction

2018-09-21 Thread Chris Katko via Digitalmars-d-learn
On Thursday, 20 September 2018 at 05:51:17 UTC, Neia Neutuladh wrote: On Thursday, 20 September 2018 at 05:34:42 UTC, Chris Katko wrote: All I want to do is loop from 0 to [constant] with a for or foreach, and have it split up across however many cores I have. You're looking at

Re: Simple parallel foreach and summation/reduction

2018-09-21 Thread Dennis via Digitalmars-d-learn
On Friday, 21 September 2018 at 07:25:17 UTC, Chris Katko wrote: I get "Error: template instance `reduce!((a, b) => a + b)` cannot use local __lambda1 as parameter to non-global template reduce(functions...)" when trying to compile that using the online D editor with DMD and LDC. Any ideas?

Re: Simple parallel foreach and summation/reduction

2018-09-21 Thread Ali Çehreli via Digitalmars-d-learn
On 09/21/2018 12:25 AM, Chris Katko wrote: On Thursday, 20 September 2018 at 05:51:17 UTC, Neia Neutuladh wrote: On Thursday, 20 September 2018 at 05:34:42 UTC, Chris Katko wrote: All I want to do is loop from 0 to [constant] with a for or foreach, and have it split up across however many

Converting a character to upper case in string

2018-09-21 Thread NX via Digitalmars-d-learn
How can I properly convert a character, say, first one to upper case in a unicode correct manner? In which code level I should be working on? Grapheme? Or maybe code point is sufficient? There are few phobos functions like asCapitalized() none of which are what I want.

Re: Converting a character to upper case in string

2018-09-21 Thread Laurent Tréguier via Digitalmars-d-learn
On Friday, 21 September 2018 at 12:15:52 UTC, NX wrote: How can I properly convert a character, say, first one to upper case in a unicode correct manner? In which code level I should be working on? Grapheme? Or maybe code point is sufficient? There are few phobos functions like

Re: Converting a character to upper case in string

2018-09-21 Thread Laurent Tréguier via Digitalmars-d-learn
On Friday, 21 September 2018 at 12:15:52 UTC, NX wrote: How can I properly convert a character, say, first one to upper case in a unicode correct manner? In which code level I should be working on? Grapheme? Or maybe code point is sufficient? There are few phobos functions like

Re: Converting a character to upper case in string

2018-09-21 Thread Laurent Tréguier via Digitalmars-d-learn
On Friday, 21 September 2018 at 13:32:54 UTC, NX wrote: On Friday, 21 September 2018 at 12:34:12 UTC, Laurent Tréguier wrote: I would probably go for std.utf.decode [1] to get the character and its length in code units, capitalize it, and concatenate the result with the rest of the string.

Re: Converting a character to upper case in string

2018-09-21 Thread NX via Digitalmars-d-learn
On Friday, 21 September 2018 at 12:34:12 UTC, Laurent Tréguier wrote: I would probably go for std.utf.decode [1] to get the character and its length in code units, capitalize it, and concatenate the result with the rest of the string. [1] https://dlang.org/phobos/std_utf.html#.decode So by

Re: Converting a character to upper case in string

2018-09-21 Thread Laurent Tréguier via Digitalmars-d-learn
On Friday, 21 September 2018 at 13:32:54 UTC, NX wrote: On Friday, 21 September 2018 at 12:34:12 UTC, Laurent Tréguier wrote: I would probably go for std.utf.decode [1] to get the character and its length in code units, capitalize it, and concatenate the result with the rest of the string.

Re: std.process.execute without capturing stderr?

2018-09-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 21 September 2018 at 06:08:39 UTC, berni wrote: Sorry, I made a mistake while testing and after I found out, that it was not available in the documentation at dpldocs.info I concluded, that it must be a really new feature. But now it seems to me, that dpldocs is outdated a little

Get variables with call stack

2018-09-21 Thread ANtlord via Digitalmars-d-learn
Hello! I need to make a some sort of error report system for an application. I want to catch base Exception class instance and report call stack and with the call stack I want to report all variables with their values. There are a couple of services that make report using call stack and

Re: "Error: function expected before (), not module *module* of type void

2018-09-21 Thread Samir via Digitalmars-d-learn
On Monday, 24 March 2008 at 17:41:11 UTC, Steven Schveighoffer wrote: I know you fixed the problem, but just an FYI, the reason is because when you import rollDice, you bring both rollDice the module and rollDice the function into the global namespace (which confuses the compiler 'cause it

Re: "Error: function expected before (), not module *module* of type void

2018-09-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 22 September 2018 at 01:51:33 UTC, Samir wrote: main.d: import isPrime; void main() { isPrime(x); } You probably shouldn't name a module the same as a member anyway, and it should also have two names, like "module myproject.isprime;" But the fix here is to just use the

Re: "Error: function expected before (), not module *module* of type void

2018-09-21 Thread Samir via Digitalmars-d-learn
On Saturday, 22 September 2018 at 01:58:57 UTC, Adam D. Ruppe wrote: You probably shouldn't name a module the same as a member anyway, and it should also have two names, like "module myproject.isprime;" But the fix here is to just use the full name. import isPrime; void main() {

Re: Get variables with call stack

2018-09-21 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 21 September 2018 at 19:08:36 UTC, ANtlord wrote: Hello! I need to make a some sort of error report system for an application. I want to catch base Exception class instance and report call stack and with the call stack I want to report all variables with their values. There are a

Re: Simple parallel foreach and summation/reduction

2018-09-21 Thread Chris Katko via Digitalmars-d-learn
On Saturday, 22 September 2018 at 02:13:58 UTC, Chris Katko wrote: On Friday, 21 September 2018 at 12:15:59 UTC, Ali Çehreli wrote: On 09/21/2018 12:25 AM, Chris Katko wrote: [...] You can use a free-standing function as a workaround, which is included in the following chapter that explains

Re: Get variables with call stack

2018-09-21 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 22 September 2018 at 05:43:53 UTC, Vladimir Panteleev wrote: The only way to do that would be using a debugger. The specifics of the solution would thus depend on the platform. On POSIX, it would probably mean getting gdb to print a detailed backtrace for your project. On

Re: Get variables with call stack

2018-09-21 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 22 September 2018 at 05:49:05 UTC, Vladimir Panteleev wrote: In short: there is no easy way, in the general sense. If you can find something that achieves what you need in C++, there's a good chance that it would work to some extent (or could be adapted with reasonable effort)

Re: Simple parallel foreach and summation/reduction

2018-09-21 Thread Chris Katko via Digitalmars-d-learn
On Friday, 21 September 2018 at 12:15:59 UTC, Ali Çehreli wrote: On 09/21/2018 12:25 AM, Chris Katko wrote: On Thursday, 20 September 2018 at 05:51:17 UTC, Neia Neutuladh wrote: On Thursday, 20 September 2018 at 05:34:42 UTC, Chris Katko wrote: All I want to do is loop from 0 to [constant]

Re: Converting a character to upper case in string

2018-09-21 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 21 September 2018 at 12:15:52 UTC, NX wrote: How can I properly convert a character, say, first one to upper case in a unicode correct manner? In which code level I should be working on? Grapheme? Or maybe code point is sufficient? There are few phobos functions like