Re: I do not understand what the problem is in this code.

2017-03-02 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 3 March 2017 at 03:11:24 UTC, steven kladitis wrote: void main() { import std.stdio, std.range, std.algorithm, std.string; const pieces = "KQRrBbNN"; alias I = indexOf; auto starts = permutations(pieces.dup).filter!(p => I(p, 'B') % 2 != I(p, 'b') % 2 && //

I do not understand what the problem is in this code.

2017-03-02 Thread steven kladitis via Digitalmars-d-learn
void main() { import std.stdio, std.range, std.algorithm, std.string; const pieces = "KQRrBbNN"; alias I = indexOf; auto starts = permutations(pieces.dup).filter!(p => I(p, 'B') % 2 != I(p, 'b') % 2 && // Bishop constraint. // King constraint.

Re: Building a project with CMAKE

2017-03-02 Thread bauss via Digitalmars-d-learn
On Thursday, 2 March 2017 at 12:42:00 UTC, Russel Winder wrote: On Tue, 2017-02-28 at 17:09 +, berni via Digitalmars-d-learn wrote: [...] I do not have an immediate answer, but… CLion requires CMake, with CMake-D in a fit state we could use CLion with D – albeit very rough and ready way,

Re: Floating point rounding

2017-03-02 Thread Guillaume Chatelet via Digitalmars-d-learn
On Thursday, 2 March 2017 at 21:34:56 UTC, ag0aep6g wrote: On 03/02/2017 10:10 PM, Guillaume Chatelet wrote: On Thursday, 2 March 2017 at 20:30:47 UTC, Guillaume Chatelet wrote: Here is the same code in D: void main(string[] args) { import std.math; FloatingPointControl fpctrl; fpct

Re: foreach for string[string]AA

2017-03-02 Thread Mike Wey via Digitalmars-d-learn
On 03/02/2017 09:09 AM, Anton Pastukhov wrote: On Wednesday, 1 March 2017 at 19:26:23 UTC, Mike Wey wrote: On 02/28/2017 07:16 PM, Anton Pastukhov wrote: On Tuesday, 28 February 2017 at 17:16:43 UTC, Daniel Kozák wrote: [...] Thank you for the link, it was informative reading. It's a pity th

Re: Floating point rounding

2017-03-02 Thread ag0aep6g via Digitalmars-d-learn
On 03/02/2017 10:10 PM, Guillaume Chatelet wrote: On Thursday, 2 March 2017 at 20:30:47 UTC, Guillaume Chatelet wrote: Here is the same code in D: void main(string[] args) { import std.math; FloatingPointControl fpctrl; fpctrl.rounding = FloatingPointControl.roundUp; writefln("%.

Re: Floating point rounding

2017-03-02 Thread Guillaume Chatelet via Digitalmars-d-learn
On Thursday, 2 March 2017 at 20:30:47 UTC, Guillaume Chatelet wrote: Here is the same code in D: void main(string[] args) { import std.math; FloatingPointControl fpctrl; fpctrl.rounding = FloatingPointControl.roundUp; writefln("%.32g", float.min_normal + 1.0f); } Execution on my

Re: forwarding build type to dependencies with dub

2017-03-02 Thread Sylvain Glaize via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 16:46:18 UTC, Johannes Loher wrote: Is it possible to forward the build type to the dependencies of a dub project? For example, if I build my project with Hello, I have the exact same problem with this exact library, dunit. I was wondering why, running dunit

Floating point rounding

2017-03-02 Thread Guillaume Chatelet via Digitalmars-d-learn
I would expect that (1.0f + smallest float subnormal) > 1.0f when the Floating Point unit is set to Round Up. Here is some C++ code: #include #include #include int main(int, char**) { std::fesetround(FE_UPWARD); printf("%.32g\n", std::numeric_limits::denorm_min() + 1.0f); retur

Re: Alignment of struct containing SIMD field - GDC

2017-03-02 Thread Johan Engelen via Digitalmars-d-learn
On Thursday, 2 March 2017 at 13:00:08 UTC, Cecil Ward wrote: Raised bug here, and I'm raising a PR now also. https://issues.dlang.org/show_bug.cgi?id=17237 Iain, this of course is present in my version of LDC too. (I checked.) You couldn't poke David Nadlinger or whoever for me? Poke recei

Re: Always std.utf.validate, or rely on exceptions?

2017-03-02 Thread SimonN via Digitalmars-d-learn
ketmar wrote: i'd say: "ALWAYS validate before ANY further processing". On Thursday, 2 March 2017 at 17:03:01 UTC, Kagamin wrote: If you expect file with malformed utf that can cause you trouble and want to handle it gracefully, pass its content through validator and catch exception from vali

Re: Always std.utf.validate, or rely on exceptions?

2017-03-02 Thread Kagamin via Digitalmars-d-learn
On Thursday, 2 March 2017 at 17:03:01 UTC, Kagamin wrote: Functions working with strings usually assume valid utf and can behave incorrectly on malformed utf. Or rather they report an unrecoverable error terminating the process.

Re: Always std.utf.validate, or rely on exceptions?

2017-03-02 Thread Kagamin via Digitalmars-d-learn
On Thursday, 2 March 2017 at 16:20:30 UTC, SimonN wrote: Should I always validate text from files manually with std.utf.validate? Or should I memorize which functions throw, then validate manually whenever I call the non-throwing UTF functions? What is the pattern behind what throws and what

Always std.utf.validate, or rely on exceptions?

2017-03-02 Thread SimonN via Digitalmars-d-learn
Many functions in std.utf throw UTFException when we pass them malformed UTF, and many functions in std.string throw StringException. From this, I developed a habit of reading user files like so, hoping that it traps all malformed UTF: try { // call D standard lib on string from fi

Re: Always std.utf.validate, or rely on exceptions?

2017-03-02 Thread ketmar via Digitalmars-d-learn
SimonN wrote: Should I always validate text from files manually with std.utf.validate? Or should I memorize which functions throw, then validate manually whenever I call the non-throwing UTF functions? What is the pattern behind what throws and what asserts false? i'd say: "ALWAYS validate

Re: Alignment of struct containing SIMD field - GDC

2017-03-02 Thread Cecil Ward via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 22:15:59 UTC, Iain Buclaw wrote: On Wednesday, 1 March 2017 at 19:09:24 UTC, Johan Engelen wrote: On Wednesday, 1 March 2017 at 18:34:16 UTC, Iain Buclaw wrote: Simple test case would be: struct vec_struct { bool b2; struct { bool b; int8

Re: Building a project with CMAKE

2017-03-02 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2017-02-28 at 17:09 +, berni via Digitalmars-d-learn wrote: > I'm using CMAKE to build my project. With  > https://github.com/dcarp/cmake-d this works almost. The only  > thing I do not manage to get working is running cmake in release  > mode. When I use -DCMAKE_BUILD_TYPE=Release I ge

Re: Libharu D binding harud unicode support

2017-03-02 Thread Kagamin via Digitalmars-d-learn
It looks like libharu or pdf don't support unicode well, see http://libharu.org/ so you probably need to select the turkish codepage and supply text in that encoding.

Re: Building a project with CMAKE

2017-03-02 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 2 March 2017 at 09:13:40 UTC, berni wrote: On Tuesday, 28 February 2017 at 17:09:28 UTC, berni wrote: I'm using CMAKE to build my project. [...] Just a note: I now asked the same question on the cmake mailing list. Maybe, it's the better place to do so... I would take a look at

Re: Building a project with CMAKE

2017-03-02 Thread berni via Digitalmars-d-learn
On Tuesday, 28 February 2017 at 17:09:28 UTC, berni wrote: I'm using CMAKE to build my project. [...] Just a note: I now asked the same question on the cmake mailing list. Maybe, it's the better place to do so...

Re: foreach for string[string]AA

2017-03-02 Thread Anton Pastukhov via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 19:26:23 UTC, Mike Wey wrote: On 02/28/2017 07:16 PM, Anton Pastukhov wrote: On Tuesday, 28 February 2017 at 17:16:43 UTC, Daniel Kozák wrote: [...] Thank you for the link, it was informative reading. It's a pity that still there is no ordered AA at least as a